3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface A { const NONE = 0; } abstract class B implements A { protected static $values; public static function get() { if (null === static::$values) { $r = new \ReflectionClass(get_called_class()); static::$values = $r->getConstants(); } return static::$values; } } class C extends B { const BLA = 1; } class D extends B { const BLAHA = 1; } var_dump(C::get()); var_dump(D::get());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YZoCI
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'b'
   23     1        DECLARE_CLASS                                            'c', 'b'
   28     2        DECLARE_CLASS                                            'd', 'b'
   33     3        INIT_FCALL                                               'var_dump'
          4        INIT_STATIC_METHOD_CALL                                  'C', 'get'
          5        DO_FCALL                                      0  $0      
          6        SEND_VAR                                                 $0
          7        DO_ICALL                                                 
   34     8        INIT_FCALL                                               'var_dump'
          9        INIT_STATIC_METHOD_CALL                                  'D', 'get'
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class A: [no user functions]
Class B:
Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/YZoCI
function name:  get
number of ops:  15
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_STATIC_PROP_R          unknown             ~1      'values'
          1        TYPE_CHECK                                    2          ~1
          2      > JMPZ                                                     ~2, ->12
   15     3    >   NEW                                              $3      'ReflectionClass'
          4        GET_CALLED_CLASS                                 ~4      
          5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $3
   16     8        INIT_METHOD_CALL                                         !0, 'getConstants'
          9        DO_FCALL                                      0  $8      
         10        ASSIGN_STATIC_PROP                                       'values'
         11        OP_DATA                                                  $8
   19    12    >   FETCH_STATIC_PROP_R          unknown             ~9      'values'
         13      > RETURN                                                   ~9
   20    14*     > RETURN                                                   null

End of function get

End of class B.

Class C: [no user functions]
Class D: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.06 ms | 1388 KiB | 15 Q