3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClass { public static function whoAmI(): void { var_dump(static::class); } } class ChildClass extends ParentClass { public function byCallUserFunc(): void { call_user_func([\ParentClass::class, "whoAmI"]); } public function byVariableFunc(): void { [\ParentClass::class, "whoAmI"](); } } $child = new ChildClass(); echo PHP_EOL . 'call_user_funccall_user_func([\ParentClass::class, "whoAmI"])' . PHP_EOL; $child->byCallUserFunc(); echo PHP_EOL . '[\ParentClass::class, "whoAmI"]()' . PHP_EOL; $child->byVariableFunc();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeh7r
function name:  (null)
number of ops:  10
compiled vars:  !0 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'ChildClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        ECHO                                                     '%0Acall_user_funccall_user_func%28%5B%5CParentClass%3A%3Aclass%2C+%22whoAmI%22%5D%29%0A'
   27     4        INIT_METHOD_CALL                                         !0, 'byCallUserFunc'
          5        DO_FCALL                                      0          
   29     6        ECHO                                                     '%0A%5B%5CParentClass%3A%3Aclass%2C+%22whoAmI%22%5D%28%29%0A'
   30     7        INIT_METHOD_CALL                                         !0, 'byVariableFunc'
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class ParentClass:
Function whoami:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeh7r
function name:  whoAmI
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_CLASS_NAME                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function whoami

End of class ParentClass.

Class ChildClass:
Function bycalluserfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeh7r
function name:  byCallUserFunc
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_USER_CALL                                0          'call_user_func', <array>
          1        DO_FCALL                                      0          
   16     2      > RETURN                                                   null

End of function bycalluserfunc

Function byvariablefunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeh7r
function name:  byVariableFunc
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_DYNAMIC_CALL                                        <array>
          1        DO_FCALL                                      0          
   21     2      > RETURN                                                   null

End of function byvariablefunc

Function whoami:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeh7r
function name:  whoAmI
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_CLASS_NAME                                 ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
    8     4      > RETURN                                                   null

End of function whoami

End of class ChildClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.93 ms | 1010 KiB | 14 Q