3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 1 => 'world', 2 => 'is', 3 => 'a', 4 => 'wonderfull', 6 => 'in', 8 => 'our' ]; $prev = -1; $i = 0; foreach ($array as $key => $val) { if (++$prev && $key - $prev) { ++$i; } $result[$i][] = $val; $prev = $key; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
Branch analysis from position: 10
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/7E5V2
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $prev, !2 = $i, !3 = $val, !4 = $key, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, -1
   12     2        ASSIGN                                                   !2, 0
   13     3      > FE_RESET_R                                       $9      !0, ->17
          4    > > FE_FETCH_R                                       ~10     $9, !3, ->17
          5    >   ASSIGN                                                   !4, ~10
   14     6        PRE_INC                                          ~12     !1
          7      > JMPZ_EX                                          ~12     ~12, ->10
          8    >   SUB                                              ~13     !4, !1
          9        BOOL                                             ~12     ~13
         10    > > JMPZ                                                     ~12, ->12
   15    11    >   PRE_INC                                                  !2
   17    12    >   FETCH_DIM_W                                      $15     !5, !2
         13        ASSIGN_DIM                                               $15
         14        OP_DATA                                                  !3
   18    15        ASSIGN                                                   !1, !4
   13    16      > JMP                                                      ->4
         17    >   FE_FREE                                                  $9
   20    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.95 ms | 1000 KiB | 14 Q