3v4l.org

run code in 300+ PHP versions simultaneously
<?php function refArray($arr) { var_dump($arr); $refs = array(); foreach ($arr as $key => $value) $refs[$key] = &$arr[$key]; var_dump($refs); return $refs; } $arr = array(3, "hello", 0.8, null); $referenceArray = refArray($arr); echo "----------------------\r\n"; var_dump($arr); var_dump($referenceArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7UaMT
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arr, !1 = $referenceArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'refarray'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   14     5        ECHO                                                     '----------------------%0D%0A'
   15     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   16     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function refarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/7UaMT
function name:  refArray
number of ops:  19
compiled vars:  !0 = $arr, !1 = $refs, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    5     4        ASSIGN                                                   !1, <array>
    6     5      > FE_RESET_R                                       $6      !0, ->13
          6    > > FE_FETCH_R                                       ~7      $6, !2, ->13
          7    >   ASSIGN                                                   !3, ~7
    7     8        FETCH_DIM_W                                      $10     !0, !3
          9        MAKE_REF                                         $11     $10
         10        FETCH_DIM_W                                      $9      !1, !3
         11        ASSIGN_REF                                               $9, $11
    6    12      > JMP                                                      ->6
         13    >   FE_FREE                                                  $6
    8    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
    9    17      > RETURN                                                   !1
   10    18*     > RETURN                                                   null

End of function refarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.19 ms | 1399 KiB | 16 Q