3v4l.org

run code in 300+ PHP versions simultaneously
<?php function setByLink( Array $tree, &$dst ) { $dst = $tree[0]; $tree[] = 'Hi'; } $tree = new ArrayObject([ new ArrayObject([ 1, 2 ]), 3 ]); setByLink( $tree, $arr ); $arr[] = 'Hello'; var_dump( is_array( $tree ), $tree );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7MOpo
function name:  (null)
number of ops:  21
compiled vars:  !0 = $tree, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'ArrayObject'
    9     1        NEW                                              $3      'ArrayObject'
   10     2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        INIT_ARRAY                                       ~5      $3
   13     5        ADD_ARRAY_ELEMENT                                ~5      3
          6        SEND_VAL_EX                                              ~5
          7        DO_FCALL                                      0          
    8     8        ASSIGN                                                   !0, $2
   16     9        INIT_FCALL                                               'setbylink'
         10        SEND_VAR                                                 !0
         11        SEND_REF                                                 !1
         12        DO_FCALL                                      0          
   17    13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  'Hello'
   18    15        INIT_FCALL                                               'var_dump'
         16        TYPE_CHECK                                  128  ~10     !0
         17        SEND_VAL                                                 ~10
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function setbylink:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7MOpo
function name:  setByLink
number of ops:  7
compiled vars:  !0 = $tree, !1 = $dst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        FETCH_DIM_R                                      ~2      !0, 0
          3        ASSIGN                                                   !1, ~2
    5     4        ASSIGN_DIM                                               !0
          5        OP_DATA                                                  'Hi'
    6     6      > RETURN                                                   null

End of function setbylink

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.53 ms | 1399 KiB | 16 Q