3v4l.org

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

Function gorrambasename:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xat3i
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:
164.01 ms | 1398 KiB | 22 Q