3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { public $indicator; public function __construct($x) { $this->indicator = $x; } } class Foo { protected $prop; public function __construct(Bar $prop) { $this->prop = $prop; } public function getProp() { return $this->prop; } } $objX = new Foo(new Bar('one')); $objY = clone $objX; $objY->getProp()->indicator = 'two'; //two, since cloned object still tracks references inside it: echo $objX->getProp()->indicator;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ll2b8
function name:  (null)
number of ops:  19
compiled vars:  !0 = $objX, !1 = $objY
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $2      'Foo'
          1        NEW                                              $3      'Bar'
          2        SEND_VAL_EX                                              'one'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $3
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   26     7        CLONE                                            ~7      !0
          8        ASSIGN                                                   !1, ~7
   27     9        INIT_METHOD_CALL                                         !1, 'getProp'
         10        DO_FCALL                                      0  $9      
         11        SEPARATE                                         $9      $9
         12        ASSIGN_OBJ                                               $9, 'indicator'
         13        OP_DATA                                                  'two'
   30    14        INIT_METHOD_CALL                                         !0, 'getProp'
         15        DO_FCALL                                      0  $11     
         16        FETCH_OBJ_R                                      ~12     $11, 'indicator'
         17        ECHO                                                     ~12
         18      > RETURN                                                   1

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

End of function __construct

End of class Bar.

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

End of function __construct

Function getprop:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ll2b8
function name:  getProp
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'prop'
          1      > RETURN                                                   ~0
   22     2*     > RETURN                                                   null

End of function getprop

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.01 ms | 1403 KiB | 13 Q