3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClass { public static function whoami() { echo static::class; } } class Child extends ParentClass { public static function whoami() { echo "Don't call me now!"; parent::whoami(); } } $className = ParentClass::class; $method = 'whoami'; $closure = function(array $args) use ($className, $method) { return forward_static_call_array([$className, $method], $args); }; $bindedClosure = $closure->bindTo(null, Child::class); $bindedClosure->__invoke([]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbS5V
function name:  (null)
number of ops:  15
compiled vars:  !0 = $className, !1 = $method, !2 = $closure, !3 = $bindedClosure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 'ParentClass'
   17     1        ASSIGN                                                   !1, 'whoami'
   18     2        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          3        BIND_LEXICAL                                             ~6, !0
          4        BIND_LEXICAL                                             ~6, !1
          5        ASSIGN                                                   !2, ~6
   22     6        INIT_METHOD_CALL                                         !2, 'bindTo'
          7        SEND_VAL_EX                                              null
          8        SEND_VAL_EX                                              'Child'
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !3, $8
   23    11        INIT_METHOD_CALL                                         !3, '__invoke'
         12        SEND_VAL_EX                                              <array>
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbS5V
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $args, !1 = $className, !2 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   19     3        INIT_FCALL                                               'forward_static_call_array'
          4        INIT_ARRAY                                       ~3      !1
          5        ADD_ARRAY_ELEMENT                                ~3      !2
          6        SEND_VAL                                                 ~3
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
   20    10*     > RETURN                                                   null

End of Dynamic Function 0

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

End of function whoami

End of class ParentClass.

Class Child:
Function whoami:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbS5V
function name:  whoami
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'Don%27t+call+me+now%21'
   12     1        INIT_STATIC_METHOD_CALL                                  'whoami'
          2        DO_FCALL                                      0          
   13     3      > RETURN                                                   null

End of function whoami

End of class Child.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.44 ms | 1003 KiB | 14 Q