3v4l.org

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

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

End of function __construct

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

End of function init

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.35 ms | 1395 KiB | 13 Q