3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 0 => '2018-02-26 13:15', 1 => '2018-02-26 13:30', 2 => '2018-02-26 13:45', 3 => '2018-02-26 14:00', 4 => '2018-02-26 14:15', 5 => '2018-02-26 14:30', 6 => '2018-02-26 14:45', 7 => '2018-02-26 15:00', 8 => '2018-02-26 15:15' ]; $store = []; $l = count($data)-1; for($i = 0; $i<$l; $i++) { if(!isset($data[$i+1])){ continue; } $store[] = [ 'start_date' => $data[$i], 'end_date' => $data[$i+1], 'break' => 0 ]; } var_dump($store);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 7
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 7
Branch analysis from position: 23
Branch analysis from position: 7
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 7
Branch analysis from position: 23
Branch analysis from position: 7
filename:       /in/5sSjs
function name:  (null)
number of ops:  27
compiled vars:  !0 = $data, !1 = $store, !2 = $l, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   15     2        COUNT                                            ~6      !0
          3        SUB                                              ~7      ~6, 1
          4        ASSIGN                                                   !2, ~7
   16     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->21
   17     7    >   ADD                                              ~10     !3, 1
          8        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !0, ~10
          9        BOOL_NOT                                         ~12     ~11
         10      > JMPZ                                                     ~12, ->12
   18    11    > > JMP                                                      ->20
   21    12    >   FETCH_DIM_R                                      ~14     !0, !3
         13        INIT_ARRAY                                       ~15     ~14, 'start_date'
   22    14        ADD                                              ~16     !3, 1
         15        FETCH_DIM_R                                      ~17     !0, ~16
         16        ADD_ARRAY_ELEMENT                                ~15     ~17, 'end_date'
   23    17        ADD_ARRAY_ELEMENT                                ~15     0, 'break'
   20    18        ASSIGN_DIM                                               !1
   23    19        OP_DATA                                                  ~15
   16    20    >   PRE_INC                                                  !3
         21    >   IS_SMALLER                                               !3, !2
         22      > JMPNZ                                                    ~19, ->7
   26    23    >   INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.23 ms | 1401 KiB | 15 Q