3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $val = 'Foo'; public static function huh() { echo eval(get_called_class().'::$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/0mDMp
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_STATIC_METHOD_CALL                                  'Foo', 'huh'
          1        DO_FCALL                                      0          
   13     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/0mDMp
function name:  huh
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GET_CALLED_CLASS                                 ~0      
          1        CONCAT                                           ~1      ~0, '%3A%3A%24val'
          2        INCLUDE_OR_EVAL                                  $2      ~1, EVAL
          3        ECHO                                                     $2
    6     4      > 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/0mDMp
function name:  huh
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GET_CALLED_CLASS                                 ~0      
          1        CONCAT                                           ~1      ~0, '%3A%3A%24val'
          2        INCLUDE_OR_EVAL                                  $2      ~1, EVAL
          3        ECHO                                                     $2
    6     4      > RETURN                                                   null

End of function huh

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.09 ms | 1393 KiB | 13 Q