3v4l.org

run code in 300+ PHP versions simultaneously
<?php 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/sQZMm
function name:  (null)
number of ops:  12
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, '%C5%A1a%C5%A1ek.txt'
   11     1        INIT_FCALL                                               'basename'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        CONCAT                                           ~3      $2, '%0A'
          5        ECHO                                                     ~3
   12     6        INIT_FCALL                                               'gorrambasename'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $4      
          9        CONCAT                                           ~5      $4, '%0A'
         10        ECHO                                                     ~5
         11      > RETURN                                                   1

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

End of function gorrambasename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.57 ms | 1398 KiB | 20 Q