3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_time_limit(1); $arr = ['a' => 'apple', 'b' => 'banana']; $child = &$arr; $i = 1; foreach ($child AS $key => $fruit) { echo $i; $child[$i] = $fruit; unset($child[$key]); $i++; } var_dump($child);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/W4Ep1
function name:  (null)
number of ops:  20
compiled vars:  !0 = $arr, !1 = $child, !2 = $i, !3 = $fruit, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'set_time_limit'
          1        SEND_VAL                                                 1
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, <array>
    7     4        ASSIGN_REF                                               !1, !0
    8     5        ASSIGN                                                   !2, 1
   10     6      > FE_RESET_R                                       $9      !1, ->15
          7    > > FE_FETCH_R                                       ~10     $9, !3, ->15
          8    >   ASSIGN                                                   !4, ~10
   12     9        ECHO                                                     !2
   13    10        ASSIGN_DIM                                               !1, !2
         11        OP_DATA                                                  !3
   14    12        UNSET_DIM                                                !1, !4
   15    13        PRE_INC                                                  !2
   10    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $9
   18    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.16 ms | 1395 KiB | 17 Q