3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static $foo = 123; protected static function bar() { echo static::class, ' value of foo is: ', self::$foo, PHP_EOL; } } class B extends A { public static function bar() { $closure = (new ReflectionMethod('A', 'bar'))->getClosure(null)->bindTo(null, B::class); $closure(); } } B::bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k4A2d
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'B', 'bar'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

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

End of function bar

End of class A.

Class B:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k4A2d
function name:  bar
number of ops:  15
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'ReflectionMethod'
          1        SEND_VAL_EX                                              'A'
          2        SEND_VAL_EX                                              'bar'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $1, 'getClosure'
          5        SEND_VAL_EX                                              null
          6        DO_FCALL                                      0  $3      
          7        INIT_METHOD_CALL                                         $3, 'bindTo'
          8        SEND_VAL_EX                                              null
          9        SEND_VAL_EX                                              'B'
         10        DO_FCALL                                      0  $4      
         11        ASSIGN                                                   !0, $4
   13    12        INIT_DYNAMIC_CALL                                        !0
         13        DO_FCALL                                      0          
   14    14      > RETURN                                                   null

End of function bar

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
188.4 ms | 1395 KiB | 13 Q