3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.29 ms | 2023 KiB | 14 Q