3v4l.org

run code in 300+ PHP versions simultaneously
<?php mb_internal_encoding('UTF-8'); setlocale(LC_ALL, 'cs_CZ.utf8'); function gorramBasename($path) { $components = explode('/', $path); return array_pop($components); // ugly, but more multibyte-safe than basename() } $path = 'šašek.txt'; echo basename($path) . "\n"; echo gorramBasename($path) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gJr76
function name:  (null)
number of ops:  19
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'mb_internal_encoding'
          1        SEND_VAL                                                 'UTF-8'
          2        DO_ICALL                                                 
    3     3        INIT_FCALL                                               'setlocale'
          4        SEND_VAL                                                 6
          5        SEND_VAL                                                 'cs_CZ.utf8'
          6        DO_ICALL                                                 
   10     7        ASSIGN                                                   !0, '%C5%A1a%C5%A1ek.txt'
   12     8        INIT_FCALL                                               'basename'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $4      
         11        CONCAT                                           ~5      $4, '%0A'
         12        ECHO                                                     ~5
   13    13        INIT_FCALL                                               'gorrambasename'
         14        SEND_VAR                                                 !0
         15        DO_FCALL                                      0  $6      
         16        CONCAT                                           ~7      $6, '%0A'
         17        ECHO                                                     ~7
         18      > RETURN                                                   1

Function gorrambasename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gJr76
function name:  gorramBasename
number of ops:  11
compiled vars:  !0 = $path, !1 = $components
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    7     6        INIT_FCALL                                               'array_pop'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
    8    10*     > RETURN                                                   null

End of function gorrambasename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.22 ms | 1403 KiB | 24 Q