3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $val = 'Foo'; public static function huh() { $class = new ReflectionClass(get_called_class()); echo $class->getStaticPropertyValue('val'); } } class Bar extends Foo { public static $val = 'bar'; } Foo::huh(); Bar::huh();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/36lKN
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  'Foo', 'huh'
          1        DO_FCALL                                      0          
   14     2        INIT_STATIC_METHOD_CALL                                  'Bar', 'huh'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class Foo:
Function huh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/36lKN
function name:  huh
number of ops:  10
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $1      'ReflectionClass'
          1        GET_CALLED_CLASS                                 ~2      
          2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    6     5        INIT_METHOD_CALL                                         !0, 'getStaticPropertyValue'
          6        SEND_VAL_EX                                              'val'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
    7     9      > RETURN                                                   null

End of function huh

End of class Foo.

Class Bar:
Function huh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/36lKN
function name:  huh
number of ops:  10
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $1      'ReflectionClass'
          1        GET_CALLED_CLASS                                 ~2      
          2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    6     5        INIT_METHOD_CALL                                         !0, 'getStaticPropertyValue'
          6        SEND_VAL_EX                                              'val'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
    7     9      > RETURN                                                   null

End of function huh

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.69 ms | 1395 KiB | 13 Q