3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C1 { public function __construct($p) { $this->p = $p; } } class C2 { public function __construct(C1 $c) { $this->c = $c; } } $c1 = new C1(1); $c2 = new C2($c1); $c1 = new C1(2); var_dump($c2->c->p);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FgjQI
function name:  (null)
number of ops:  18
compiled vars:  !0 = $c1, !1 = $c2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $2      'C1'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   14     4        NEW                                              $5      'C2'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   15     8        NEW                                              $8      'C1'
          9        SEND_VAL_EX                                              2
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $8
   16    12        INIT_FCALL                                               'var_dump'
         13        FETCH_OBJ_R                                      ~11     !1, 'c'
         14        FETCH_OBJ_R                                      ~12     ~11, 'p'
         15        SEND_VAL                                                 ~12
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class C1:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FgjQI
function name:  __construct
number of ops:  4
compiled vars:  !0 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN_OBJ                                               'p'
          2        OP_DATA                                                  !0
    5     3      > RETURN                                                   null

End of function __construct

End of class C1.

Class C2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FgjQI
function name:  __construct
number of ops:  4
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'c'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

End of class C2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.7 ms | 1396 KiB | 15 Q