3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = ""; } $foo = new Foo(); function modifiesLocallyClonedFoo($foo) { $foo = clone $foo; $foo->bar = "bar"; } modifiesLocallyClonedFoo($foo); var_dump($foo); $bar = &$foo; modifiesLocallyClonedFoo($foo); var_dump($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3s7B5
function name:  (null)
number of ops:  17
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   16     3        INIT_FCALL                                               'modifieslocallyclonedfoo'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0          
   17     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   19     9        ASSIGN_REF                                               !1, !0
   21    10        INIT_FCALL                                               'modifieslocallyclonedfoo'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0          
   22    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function modifieslocallyclonedfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3s7B5
function name:  modifiesLocallyClonedFoo
number of ops:  6
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        CLONE                                            ~1      !0
          2        ASSIGN                                                   !0, ~1
   13     3        ASSIGN_OBJ                                               !0, 'bar'
          4        OP_DATA                                                  'bar'
   14     5      > RETURN                                                   null

End of function modifieslocallyclonedfoo

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
125.57 ms | 1402 KiB | 17 Q