3v4l.org

run code in 300+ PHP versions simultaneously
<?php function refArray($arr) { return $refs; } $arr = [3, "hello", 0.8, null]; $refs = []; foreach ($arr as $key => $value) $refs[$key] = &$arr[$key]; $copy = $arr; var_dump($arr); var_dump($refs); var_dump($copy);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/DpBS2
function name:  (null)
number of ops:  22
compiled vars:  !0 = $arr, !1 = $refs, !2 = $value, !3 = $key, !4 = $copy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $7      !0, ->10
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->10
          4    >   ASSIGN                                                   !3, ~8
   11     5        FETCH_DIM_W                                      $11     !0, !3
          6        MAKE_REF                                         $12     $11
          7        FETCH_DIM_W                                      $10     !1, !3
          8        ASSIGN_REF                                               $10, $12
   10     9      > JMP                                                      ->3
         10    >   FE_FREE                                                  $7
   13    11        ASSIGN                                                   !4, !0
   14    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   15    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   16    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function refarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DpBS2
function name:  refArray
number of ops:  3
compiled vars:  !0 = $arr, !1 = $refs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1      > RETURN                                                   !1
    5     2*     > RETURN                                                   null

End of function refarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.6 ms | 1401 KiB | 15 Q