3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ //"STOPSALES", "2023-03-10", "2023-03-11", "2023-03-12", "2023-03-13", "2023-03-14", "2023-03-15", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "STOPSALES", "2023-03-27", "2023-03-28", "2023-03-29", "2023-03-30", "2023-03-31", "2023-04-01", "2023-04-02", "2023-04-03", ]; $result = []; foreach ($array as $v) { if ($v === 'STOPSALES') { unset($ref); continue; } if (!isset($ref)) { $ref = [$v]; $result[] = &$ref; } else { $ref[] = $v; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/Emufo
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array, !1 = $result, !2 = $v, !3 = $ref
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   32     1        ASSIGN                                                       !1, <array>
   33     2      > FE_RESET_R                                           $6      !0, ->19
          3    > > FE_FETCH_R                                                   $6, !2, ->19
   34     4    >   IS_IDENTICAL                                                 !2, 'STOPSALES'
          5      > JMPZ                                                         ~7, ->8
   35     6    >   UNSET_CV                                                     !3
   36     7      > JMP                                                          ->3
   38     8    >   ISSET_ISEMPTY_CV                                     ~8      !3
          9        BOOL_NOT                                             ~9      ~8
         10      > JMPZ                                                         ~9, ->16
   39    11    >   INIT_ARRAY                                           ~10     !2
         12        ASSIGN                                                       !3, ~10
   40    13        FETCH_DIM_W                                          $12     !1
         14        ASSIGN_REF                                                   $12, !3
   38    15      > JMP                                                          ->18
   42    16    >   ASSIGN_DIM                                                   !3
         17        OP_DATA                                                      !2
   33    18    > > JMP                                                          ->3
         19    >   FE_FREE                                                      $6
   45    20        INIT_FCALL                                                   'var_export'
         21        SEND_VAR                                                     !1
         22        DO_ICALL                                                     
         23      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.52 ms | 1814 KiB | 14 Q