3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MySpl extends SplFileInfo { public function getExtension() { if (method_exists(parent, '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/1k8nQ
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 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1k8nQ
function name:  getExtension
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'method_exists'
          1        FETCH_CONSTANT                                   ~0      'parent'
          2        SEND_VAL                                                 ~0
          3        SEND_VAL                                                 'getExtension'
          4        DO_ICALL                                         $1      
          5      > JMPZ                                                     $1, ->11
    8     6    >   ECHO                                                     'parent'
          7        ECHO                                                     '%0A'
    9     8        INIT_STATIC_METHOD_CALL                                  'getExtension'
          9        DO_FCALL                                      0  $2      
         10      > RETURN                                                   $2
   12    11    >   INIT_FCALL                                               'end'
         12        INIT_FCALL                                               'explode'
         13        SEND_VAL                                                 '.'
         14        INIT_STATIC_METHOD_CALL                                  'getPathname'
         15        DO_FCALL                                      0  $3      
         16        SEND_VAR                                                 $3
         17        DO_ICALL                                         $4      
         18        SEND_VAR_NO_REF                               0          $4
         19        DO_ICALL                                         $5      
         20      > RETURN                                                   $5
   13    21*     > RETURN                                                   null

End of function getextension

End of class MySpl.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.48 ms | 1400 KiB | 21 Q