3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static function foo() { echo static::class, ' in ', self::class, PHP_EOL; } } class B extends A {} B::foo(); $closure = (new ReflectionMethod('A', 'foo'))->getClosure(null)->bindTo(null, B::class); $closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/clcoq
function name:  (null)
number of ops:  17
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'B', 'foo'
          1        DO_FCALL                                      0          
   12     2        NEW                                              $2      'ReflectionMethod'
          3        SEND_VAL_EX                                              'A'
          4        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0          
          6        INIT_METHOD_CALL                                         $2, 'getClosure'
          7        SEND_VAL_EX                                              null
          8        DO_FCALL                                      0  $4      
          9        INIT_METHOD_CALL                                         $4, 'bindTo'
         10        SEND_VAL_EX                                              null
         11        SEND_VAL_EX                                              'B'
         12        DO_FCALL                                      0  $5      
         13        ASSIGN                                                   !0, $5
   13    14        INIT_DYNAMIC_CALL                                        !0
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

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

End of function foo

End of class A.

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

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.02 ms | 1395 KiB | 13 Q