3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $b; public function __construct(B $b) { $this->b = $b; var_dump($b::OMG); var_dump($this->b->OMG); } } class B { const OMG = 10; public function __get($name) { return constant("self::" . $name); } } $b = new B(); $a = new A($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HupHi
function name:  (null)
number of ops:  8
compiled vars:  !0 = $b, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   23     3        NEW                                              $5      'A'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
          7      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HupHi
function name:  __construct
number of ops:  14
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'b'
          2        OP_DATA                                                  !0
    8     3        INIT_FCALL                                               'var_dump'
          4        FETCH_CLASS                                   0  $2      !0
          5        FETCH_CLASS_CONSTANT                             ~3      $2, 'OMG'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                                 
    9     8        INIT_FCALL                                               'var_dump'
          9        FETCH_OBJ_R                                      ~5      'b'
         10        FETCH_OBJ_R                                      ~6      ~5, 'OMG'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
   11    13      > RETURN                                                   null

End of function __construct

End of class A.

Class B:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HupHi
function name:  __get
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'constant'
          2        CONCAT                                           ~1      'self%3A%3A', !0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5      > RETURN                                                   $2
   19     6*     > RETURN                                                   null

End of function __get

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.74 ms | 1396 KiB | 17 Q