3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array(1, 2, 3); $ref =& $array1[2]; // now $array[2] is a reference var_dump($array1); // [2] => &int(3) // this makes a copy of what's in $array1, not just the values within // $array2[2] will be a copy *of the reference* $array2 = $array1; var_dump($array2); // [2] => &int(3) // as such, changing the value of $array2[2] will also change $array1[2] $array2[2] = 10; var_dump($array1); // [2] => &int(10)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5TqMB
function name:  (null)
number of ops:  16
compiled vars:  !0 = $array1, !1 = $ref, !2 = $array2
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
    7     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   11     6        ASSIGN                                                   !2, !0
   12     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
   15    10        ASSIGN_DIM                                               !2, 2
         11        OP_DATA                                                  10
   16    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.88 ms | 996 KiB | 14 Q