3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(0, 1, 2); $ref = &$a[2]; $b = $a; // Element [2] is not int(2) but &int(2) var_dump($a); // Updating $ref also updates $a[2], as expected $ref = 99; var_dump($a); // $b[2] is also &int(99), it references the same object as $a[2] and $ref var_dump($b); // Therefore we can do the same update by reference $b[2] = 1234; var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Hqiu8
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a, !1 = $ref, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        FETCH_DIM_W                                      $4      !0, 2
          2        ASSIGN_REF                                               !1, $4
    5     3        ASSIGN                                                   !2, !0
    8     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
   11     7        ASSIGN                                                   !1, 99
   12     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   15    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
   18    14        ASSIGN_DIM                                               !2, 2
         15        OP_DATA                                                  1234
   19    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.77 ms | 1394 KiB | 15 Q