3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($path) { echo "Testing: $path\n"; $file = new \SplFileInfo($path); var_dump($file->getBasename()); var_dump($file->getFilename()); } test('/dir/anotherdir/basedir//'); test('/dir/anotherdir/basedir/'); test('/dir/anotherdir/basedir'); test('/dir/anotherdir//basedir'); test('///'); test('//'); test('/'); test('');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JFmUj
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAL                                                 '%2Fdir%2Fanotherdir%2Fbasedir%2F%2F'
          2        DO_FCALL                                      0          
   11     3        INIT_FCALL                                               'test'
          4        SEND_VAL                                                 '%2Fdir%2Fanotherdir%2Fbasedir%2F'
          5        DO_FCALL                                      0          
   12     6        INIT_FCALL                                               'test'
          7        SEND_VAL                                                 '%2Fdir%2Fanotherdir%2Fbasedir'
          8        DO_FCALL                                      0          
   13     9        INIT_FCALL                                               'test'
         10        SEND_VAL                                                 '%2Fdir%2Fanotherdir%2F%2Fbasedir'
         11        DO_FCALL                                      0          
   14    12        INIT_FCALL                                               'test'
         13        SEND_VAL                                                 '%2F%2F%2F'
         14        DO_FCALL                                      0          
   15    15        INIT_FCALL                                               'test'
         16        SEND_VAL                                                 '%2F%2F'
         17        DO_FCALL                                      0          
   16    18        INIT_FCALL                                               'test'
         19        SEND_VAL                                                 '%2F'
         20        DO_FCALL                                      0          
   17    21        INIT_FCALL                                               'test'
         22        SEND_VAL                                                 ''
         23        DO_FCALL                                      0          
         24      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JFmUj
function name:  test
number of ops:  20
compiled vars:  !0 = $path, !1 = $file
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ROPE_INIT                                     3  ~3      'Testing%3A+'
          2        ROPE_ADD                                      1  ~3      ~3, !0
          3        ROPE_END                                      2  ~2      ~3, '%0A'
          4        ECHO                                                     ~2
    5     5        NEW                                              $5      'SplFileInfo'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
    6     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !1, 'getBasename'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                                 
    7    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !1, 'getFilename'
         16        DO_FCALL                                      0  $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                                 
    8    19      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.68 ms | 1005 KiB | 22 Q