3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &test() { $var = array(); $var[] =& $var; return $var; }; $a = test(); $b = $a; $b[0] = 123; print_r($a); print_r($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0g0ID
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   12     3        ASSIGN                                                   !1, !0
   13     4        ASSIGN_DIM                                               !1, 0
          5        OP_DATA                                                  123
   15     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   16     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/0g0ID
function name:  test
number of ops:  5
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    6     1        FETCH_DIM_W                                      $2      !0
          2        ASSIGN_REF                                               $2, !0
    8     3      > RETURN_BY_REF                                            !0
    9     4*     > RETURN_BY_REF                                            null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.59 ms | 999 KiB | 15 Q