3v4l.org

run code in 500+ PHP versions simultaneously
<?php $orig = new stdClass(); $orig->test = 'original'; $ptr = & $orig->test; // <--- Setting an unused reference changes the behaviour $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 = 61) Position 1 = -2
filename:       /in/70ZIS
function name:  (null)
number of ops:  18
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
    8     7        CLONE                                                ~9      !0
          8        ASSIGN                                                       !2, ~9
    9     9        ASSIGN_OBJ                                                   !2, 'test'
         10        OP_DATA                                                      'modified'
   11    11      > INIT_FCALL                                                   'exit'
         12*       NOP                                                          
         13*       FETCH_OBJ_R                                          ~12     !0, 'test'
         14*       FAST_CONCAT                                          ~13     'Orig+is%3A+', ~12
         15*       SEND_VAL                                                     ~13
         16*       DO_ICALL                                                     
         17*     > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.04 ms | 1421 KiB | 9 Q