3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public $var; public function __construct($var) { $this->var = $var; } } class A { public $var; public function __construct(B $var) { $this->var = $var; } } $b = new B('test'); $a = new A($b); $b->var = 'test2'; echo $b->var; echo $a->var;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/icqg0
function name:  (null)
number of ops:  15
compiled vars:  !0 = $b, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'B'
          1        SEND_VAL_EX                                              'test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   16     4        NEW                                              $5      'A'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   18     8        ASSIGN_OBJ                                               !0, 'var'
          9        OP_DATA                                                  'test2'
   20    10        FETCH_OBJ_R                                      ~9      !0, 'var'
         11        ECHO                                                     ~9
   21    12        FETCH_OBJ_R                                      ~10     !1, 'var'
         13        ECHO                                                     ~10
         14      > RETURN                                                   1

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

End of function __construct

End of class B.

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

End of function __construct

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.89 ms | 1395 KiB | 13 Q