3v4l.org

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

Class A:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WRuZ6
function name:  bar
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'scope+is%3A+'
          1        FETCH_CLASS_NAME                                 ~0      
          2        ECHO                                                     ~0
          3        ECHO                                                     '+value+of+self%3A%3A%24foo+is%3A+'
          4        FETCH_STATIC_PROP_R          unknown             ~1      'foo'
          5        ECHO                                                     ~1
          6        ECHO                                                     '%0A'
    7     7      > 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/WRuZ6
function name:  bar
number of ops:  12
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     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        FETCH_THIS                                       $3      
          6        SEND_VAR_EX                                              $3
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !0, $4
   15     9        INIT_DYNAMIC_CALL                                        !0
         10        DO_FCALL                                      0          
   16    11      > RETURN                                                   null

End of function bar

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.61 ms | 1000 KiB | 13 Q