3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = [ 'name' => 'hi', ]; $ref = [ 'name' => 'hi', ]; $context = [ 'var' => $var, 'reference' => &$ref, ]; function func(&$change_me, $context) { $change_me = 2; $context['var']['name'] = 'foo'; $context['reference']['name'] = 'bar'; } $change_me = 1; func($change_me, $context); print_r([$change_me, $context]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bEJhv
function name:  (null)
number of ops:  16
compiled vars:  !0 = $var, !1 = $ref, !2 = $context, !3 = $change_me
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        ASSIGN                                                   !1, <array>
   12     2        INIT_ARRAY                                       ~6      !0, 'var'
   13     3        ADD_ARRAY_ELEMENT                                ~6      !1, 'reference'
   11     4        ASSIGN                                                   !2, ~6
   22     5        ASSIGN                                                   !3, 1
   24     6        INIT_FCALL                                               'func'
          7        SEND_REF                                                 !3
          8        SEND_VAR                                                 !2
          9        DO_FCALL                                      0          
   26    10        INIT_FCALL                                               'print_r'
         11        INIT_ARRAY                                       ~10     !3
         12        ADD_ARRAY_ELEMENT                                ~10     !2
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bEJhv
function name:  func
number of ops:  10
compiled vars:  !0 = $change_me, !1 = $context
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        ASSIGN                                                   !0, 2
   18     3        FETCH_DIM_W                                      $3      !1, 'var'
          4        ASSIGN_DIM                                               $3, 'name'
          5        OP_DATA                                                  'foo'
   19     6        FETCH_DIM_W                                      $5      !1, 'reference'
          7        ASSIGN_DIM                                               $5, 'name'
          8        OP_DATA                                                  'bar'
   20     9      > RETURN                                                   null

End of function func

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.41 ms | 1398 KiB | 16 Q