3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySpl extends SplFileInfo { public function getExtension() { if (method_exists('SplFileInfo', 'getExtension')) { echo 'parent', PHP_EOL; return parent::getExtension(); } return end(explode('.', parent::getPathname())); } } foreach (array('foo.bar', 'baz.tar.gz', '/usr/bin/php', 'foo') as $file) { $spl = new MySpl($file); var_dump($spl->getExtension()); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 12
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/AOpjf
function name:  (null)
number of ops:  14
compiled vars:  !0 = $file, !1 = $spl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E > > FE_RESET_R                                       $2      <array>, ->12
          1    > > FE_FETCH_R                                               $2, !0, ->12
   17     2    >   NEW                                              $3      'MySpl'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
   19     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !1, 'getExtension'
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
   16    11      > JMP                                                      ->1
         12    >   FE_FREE                                                  $2
   20    13      > RETURN                                                   1

Class MySpl:
Function getextension:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AOpjf
function name:  getExtension
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'method_exists'
          1        SEND_VAL                                                 'SplFileInfo'
          2        SEND_VAL                                                 'getExtension'
          3        DO_ICALL                                         $0      
          4      > JMPZ                                                     $0, ->10
    8     5    >   ECHO                                                     'parent'
          6        ECHO                                                     '%0A'
    9     7        INIT_STATIC_METHOD_CALL                                  'getExtension'
          8        DO_FCALL                                      0  $1      
          9      > RETURN                                                   $1
   12    10    >   INIT_FCALL                                               'end'
         11        INIT_FCALL                                               'explode'
         12        SEND_VAL                                                 '.'
         13        INIT_STATIC_METHOD_CALL                                  'getPathname'
         14        DO_FCALL                                      0  $2      
         15        SEND_VAR                                                 $2
         16        DO_ICALL                                         $3      
         17        SEND_VAR_NO_REF                               0          $3
         18        DO_ICALL                                         $4      
         19      > RETURN                                                   $4
   13    20*     > RETURN                                                   null

End of function getextension

End of class MySpl.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.92 ms | 1400 KiB | 21 Q