3v4l.org

run code in 300+ PHP versions simultaneously
<?php $orig = new stdClass(); $orig->test = 'original'; $ptr = & $orig->test; // <--- Setting an unused reference changes the behaviour unset($ptr); // $ptr goes away and $orig->test reverts to a normal unreferenced value $copy = clone $orig; $copy->test = "modified"; die("Orig is: {$orig->test}"); // Gives 'modified' instead of 'original'
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/c6epk
function name:  (null)
number of ops:  17
compiled vars:  !0 = $orig, !1 = $ptr, !2 = $copy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    4     3        ASSIGN_OBJ                                               !0, 'test'
          4        OP_DATA                                                  'original'
    6     5        FETCH_OBJ_W                                      $7      !0, 'test'
          6        ASSIGN_REF                                               !1, $7
    7     7        UNSET_CV                                                 !1
    9     8        CLONE                                            ~9      !0
          9        ASSIGN                                                   !2, ~9
   10    10        ASSIGN_OBJ                                               !2, 'test'
         11        OP_DATA                                                  'modified'
   12    12        NOP                                                      
         13        FETCH_OBJ_R                                      ~12     !0, 'test'
         14        FAST_CONCAT                                      ~13     'Orig+is%3A+', ~12
         15      > EXIT                                                     ~13
         16*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.7 ms | 1397 KiB | 13 Q