3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C extends B { const B = 'b'; } class B extends A { const A = 'a'; } abstract class A { public static function get() { self::resolve(); } private static function resolve() { $r = new ReflectionClass(get_called_class()); var_dump($r->getConstants()); } } A::get(); B::get(); C::get();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0lGQY
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'c', 'b'
    8     1        DECLARE_CLASS                                            'b', 'a'
   27     2        INIT_STATIC_METHOD_CALL                                  'A', 'get'
          3        DO_FCALL                                      0          
   28     4        INIT_STATIC_METHOD_CALL                                  'B', 'get'
          5        DO_FCALL                                      0          
   29     6        INIT_STATIC_METHOD_CALL                                  'C', 'get'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class C: [no user functions]
Class B: [no user functions]
Class A:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0lGQY
function name:  get
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'resolve'
          1        DO_FCALL                                      0          
   18     2      > RETURN                                                   null

End of function get

Function resolve:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0lGQY
function name:  resolve
number of ops:  11
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'ReflectionClass'
          1        GET_CALLED_CLASS                                 ~2      
          2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   23     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'getConstants'
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
   24    10      > RETURN                                                   null

End of function resolve

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.1 ms | 1396 KiB | 15 Q