3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [1,2,3]; $array2 = &$array; foreach($array as $val) { unset($array[1]); // modify array being iterated over echo "{$val} - ", current($array), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/3BEGF
function name:  (null)
number of ops:  16
compiled vars:  !0 = $array, !1 = $array2, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN_REF                                               !1, !0
    5     2      > FE_RESET_R                                       $5      !0, ->14
          3    > > FE_FETCH_R                                               $5, !2, ->14
    6     4    >   UNSET_DIM                                                !0, 1
    7     5        NOP                                                      
          6        FAST_CONCAT                                      ~6      !2, '+-+'
          7        ECHO                                                     ~6
          8        INIT_FCALL                                               'current'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ECHO                                                     $7
         12        ECHO                                                     '%0A'
    5    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $5
    8    15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.77 ms | 1395 KiB | 15 Q