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) { unset($arr[$key + 1]); echo $value . PHP_EOL; } var_dump($arr); echo '#######################'. PHP_EOL; $arr = array(1,2,3,4,5,6,7,8,9); while (list($key, $value) = each($arr)) { unset($arr[$key + 1]); echo $value . PHP_EOL; } var_dump($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 16
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 16
Branch analysis from position: 28
Branch analysis from position: 16
Branch analysis from position: 9
filename:       /in/FB1Rl
function name:  (null)
number of ops:  32
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, ->9
          2    > > FE_FETCH_R                                       ~5      $4, !1, ->9
          3    >   ASSIGN                                                   !2, ~5
    7     4        ADD                                              ~7      !2, 1
          5        UNSET_DIM                                                !0, ~7
    8     6        CONCAT                                           ~8      !1, '%0A'
          7        ECHO                                                     ~8
    5     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $4
   11    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   13    13        ECHO                                                     '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A'
   15    14        ASSIGN                                                   !0, <array>
   17    15      > JMP                                                      ->20
   19    16    >   ADD                                              ~11     !2, 1
         17        UNSET_DIM                                                !0, ~11
   20    18        CONCAT                                           ~12     !1, '%0A'
         19        ECHO                                                     ~12
   17    20    >   INIT_FCALL_BY_NAME                                       'each'
         21        SEND_VAR_EX                                              !0
         22        DO_FCALL                                      0  $13     
         23        FETCH_LIST_R                                     $14     $13, 0
         24        ASSIGN                                                   !2, $14
         25        FETCH_LIST_R                                     $16     $13, 1
         26        ASSIGN                                                   !1, $16
         27      > JMPNZ                                                    $13, ->16
   23    28    >   INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.59 ms | 1388 KiB | 18 Q