3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(1,2,3,4,5,6,7,8,9); foreach($arr as $key=>$value) { var_dump($arr); unset($arr[$key + 1]); echo $value . "\n"; echo "key=" . $key . ", value=" . $value . ", key+1=" . ($key+1) . "\n\n"; var_dump($arr); } echo("last:"); var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 23
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/aXIsM
function name:  (null)
number of ops:  29
compiled vars:  !0 = $arr, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_R                                       $4      !0, ->23
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->23
          3    >   ASSIGN                                                   !2, ~5
    7     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
    8     7        ADD                                              ~8      !2, 1
          8        UNSET_DIM                                                !0, ~8
    9     9        CONCAT                                           ~9      !1, '%0A'
         10        ECHO                                                     ~9
   10    11        CONCAT                                           ~10     'key%3D', !2
         12        CONCAT                                           ~11     ~10, '%2C+value%3D'
         13        CONCAT                                           ~12     ~11, !1
         14        CONCAT                                           ~13     ~12, '%2C+key%2B1%3D'
         15        ADD                                              ~14     !2, 1
         16        CONCAT                                           ~15     ~13, ~14
         17        CONCAT                                           ~16     ~15, '%0A%0A'
         18        ECHO                                                     ~16
   11    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
    5    22      > JMP                                                      ->2
         23    >   FE_FREE                                                  $4
   13    24        ECHO                                                     'last%3A'
   14    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.28 ms | 1400 KiB | 15 Q