3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = ['12:00am','12:15am','12:30am','12:45am','1:00am','1:15am','1:30am','1:45am','2:00am','3:15am','3:30am','3:45am','4:00am','1:00pm','1:15pm','1:30pm']; $new = []; $temp = []; $total = count($arr); for($i=0; $i< $total;$i++){ $k = $i+1; if(isset($arr[$k]) && strtotime($arr[$k]) - strtotime($arr[$i]) == 900){ $temp[] = $arr[$i]; }else{ $temp[] = $arr[$i]; $new[] = $temp; $temp = []; } } print_r($new);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 7
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 7
Branch analysis from position: 36
Branch analysis from position: 7
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 7
Branch analysis from position: 36
Branch analysis from position: 7
Branch analysis from position: 22
filename:       /in/B5U1S
function name:  (null)
number of ops:  40
compiled vars:  !0 = $arr, !1 = $new, !2 = $temp, !3 = $total, !4 = $i, !5 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2        ASSIGN                                                       !2, <array>
    6     3        COUNT                                                ~9      !0
          4        ASSIGN                                                       !3, ~9
    7     5        ASSIGN                                                       !4, 0
          6      > JMP                                                          ->34
    8     7    >   ADD                                                  ~12     !4, 1
          8        ASSIGN                                                       !5, ~12
    9     9        ISSET_ISEMPTY_DIM_OBJ                             0  ~14     !0, !5
         10      > JMPZ_EX                                              ~14     ~14, ->22
         11    >   INIT_FCALL                                                   'strtotime'
         12        FETCH_DIM_R                                          ~15     !0, !5
         13        SEND_VAL                                                     ~15
         14        DO_ICALL                                             $16     
         15        INIT_FCALL                                                   'strtotime'
         16        FETCH_DIM_R                                          ~17     !0, !4
         17        SEND_VAL                                                     ~17
         18        DO_ICALL                                             $18     
         19        SUB                                                  ~19     $16, $18
         20        IS_EQUAL                                             ~20     ~19, 900
         21        BOOL                                                 ~14     ~20
         22    > > JMPZ                                                         ~14, ->27
   10    23    >   FETCH_DIM_R                                          ~22     !0, !4
         24        ASSIGN_DIM                                                   !2
         25        OP_DATA                                                      ~22
    9    26      > JMP                                                          ->33
   12    27    >   FETCH_DIM_R                                          ~24     !0, !4
         28        ASSIGN_DIM                                                   !2
         29        OP_DATA                                                      ~24
   13    30        ASSIGN_DIM                                                   !1
         31        OP_DATA                                                      !2
   14    32        ASSIGN                                                       !2, <array>
    7    33    >   PRE_INC                                                      !4
         34    >   IS_SMALLER                                                   !4, !3
         35      > JMPNZ                                                        ~28, ->7
   17    36    >   INIT_FCALL                                                   'print_r'
         37        SEND_VAR                                                     !1
         38        DO_ICALL                                                     
         39      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
225.41 ms | 2255 KiB | 14 Q