3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __toString() { return 'stringable'; } } $inputs = [null, false, true, 0, 1, new Foo()]; foreach ($inputs as $input) { $sfi = new SplFileInfo($input); print("-----\n"); var_export($input); print("\n"); var_export($sfi->getPathname()); print("\n"); var_export($sfi->getPath()); print("\n"); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 34
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 34
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/JcZaf
function name:  (null)
number of ops:  36
compiled vars:  !0 = $inputs, !1 = $input, !2 = $sfi
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'foo'
    9     1        INIT_ARRAY                                           ~3      null
          2        ADD_ARRAY_ELEMENT                                    ~3      <false>
          3        ADD_ARRAY_ELEMENT                                    ~3      <true>
          4        ADD_ARRAY_ELEMENT                                    ~3      0
          5        ADD_ARRAY_ELEMENT                                    ~3      1
          6        NEW                                                  $4      'Foo'
          7        DO_FCALL                                          0          
          8        ADD_ARRAY_ELEMENT                                    ~3      $4
          9        ASSIGN                                                       !0, ~3
   11    10      > FE_RESET_R                                           $7      !0, ->34
         11    > > FE_FETCH_R                                                   $7, !1, ->34
   12    12    >   NEW                                                  $8      'SplFileInfo'
         13        SEND_VAR_EX                                                  !1
         14        DO_FCALL                                          0          
         15        ASSIGN                                                       !2, $8
   13    16        ECHO                                                         '-----%0A'
   14    17        INIT_FCALL                                                   'var_export'
         18        SEND_VAR                                                     !1
         19        DO_ICALL                                                     
   15    20        ECHO                                                         '%0A'
   16    21        INIT_FCALL                                                   'var_export'
         22        INIT_METHOD_CALL                                             !2, 'getPathname'
         23        DO_FCALL                                          0  $12     
         24        SEND_VAR                                                     $12
         25        DO_ICALL                                                     
   17    26        ECHO                                                         '%0A'
   18    27        INIT_FCALL                                                   'var_export'
         28        INIT_METHOD_CALL                                             !2, 'getPath'
         29        DO_FCALL                                          0  $14     
         30        SEND_VAR                                                     $14
         31        DO_ICALL                                                     
   19    32        ECHO                                                         '%0A'
   11    33      > JMP                                                          ->11
         34    >   FE_FREE                                                      $7
   20    35      > RETURN                                                       1

Class Foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JcZaf
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                       'stringable'
    6     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
202.62 ms | 2168 KiB | 14 Q