3v4l.org

run code in 300+ PHP versions simultaneously
<?php $symbolstocheck = [1, 1, 3, 1, 5]; $prev = null; $keyz = -1; $res = []; foreach ($symbolstocheck as $value) { $value = (int)$value; if ($value !== $prev) { $keyz++; } $prev = $value; if (!isset($res[$keyz])) { $res[$keyz] = ''; } $res[$keyz] .= $value; } var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 17
Branch analysis from position: 11
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/42X7s
function name:  (null)
number of ops:  25
compiled vars:  !0 = $symbolstocheck, !1 = $prev, !2 = $keyz, !3 = $res, !4 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, null
    5     2        ASSIGN                                                   !2, -1
    6     3        ASSIGN                                                   !3, <array>
    8     4      > FE_RESET_R                                       $9      !0, ->20
          5    > > FE_FETCH_R                                               $9, !4, ->20
    9     6    >   CAST                                          4  ~10     !4
          7        ASSIGN                                                   !4, ~10
   11     8        IS_NOT_IDENTICAL                                         !4, !1
          9      > JMPZ                                                     ~12, ->11
   12    10    >   PRE_INC                                                  !2
   15    11    >   ASSIGN                                                   !1, !4
   17    12        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !3, !2
         13        BOOL_NOT                                         ~16     ~15
         14      > JMPZ                                                     ~16, ->17
   18    15    >   ASSIGN_DIM                                               !3, !2
         16        OP_DATA                                                  ''
   21    17    >   ASSIGN_DIM_OP                .=               8          !3, !2
         18        OP_DATA                                                  !4
    8    19      > JMP                                                      ->5
         20    >   FE_FREE                                                  $9
   24    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.45 ms | 999 KiB | 14 Q