3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datesarray = array('2012-10-01', '2012-10-03', '2012-10-04', '2012-10-05', '2012-10-08', '2012-10-09'); $count = 0; $result = "Nothing found"; $diff = strtotime('2014-05-07') - strtotime('2014-05-06'); for ($i=2, $c=count($datesarray); $i<$c; ++$i) { if (strtotime($datesarray[$i-1]) - strtotime($datesarray[$i-2]) == $diff && strtotime($datesarray[$i]) - strtotime($datesarray[$i-2]) == $diff * 2) { $result = "3 Consecutive dates found"; break; } } echo "Result: $result";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 15
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 41
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 15
Branch analysis from position: 47
Branch analysis from position: 15
Branch analysis from position: 41
filename:       /in/c1aQZ
function name:  (null)
number of ops:  51
compiled vars:  !0 = $datesarray, !1 = $count, !2 = $result, !3 = $diff, !4 = $i, !5 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, 'Nothing+found'
    8     3        INIT_FCALL                                               'strtotime'
          4        SEND_VAL                                                 '2014-05-07'
          5        DO_ICALL                                         $9      
          6        INIT_FCALL                                               'strtotime'
          7        SEND_VAL                                                 '2014-05-06'
          8        DO_ICALL                                         $10     
          9        SUB                                              ~11     $9, $10
         10        ASSIGN                                                   !3, ~11
   10    11        ASSIGN                                                   !4, 2
         12        COUNT                                            ~14     !0
         13        ASSIGN                                                   !5, ~14
         14      > JMP                                                      ->45
   11    15    >   INIT_FCALL                                               'strtotime'
         16        SUB                                              ~16     !4, 1
         17        FETCH_DIM_R                                      ~17     !0, ~16
         18        SEND_VAL                                                 ~17
         19        DO_ICALL                                         $18     
         20        INIT_FCALL                                               'strtotime'
         21        SUB                                              ~19     !4, 2
         22        FETCH_DIM_R                                      ~20     !0, ~19
         23        SEND_VAL                                                 ~20
         24        DO_ICALL                                         $21     
         25        SUB                                              ~22     $18, $21
         26        IS_EQUAL                                         ~23     !3, ~22
         27      > JMPZ_EX                                          ~23     ~23, ->41
   12    28    >   INIT_FCALL                                               'strtotime'
         29        FETCH_DIM_R                                      ~24     !0, !4
         30        SEND_VAL                                                 ~24
         31        DO_ICALL                                         $25     
         32        INIT_FCALL                                               'strtotime'
         33        SUB                                              ~26     !4, 2
         34        FETCH_DIM_R                                      ~27     !0, ~26
         35        SEND_VAL                                                 ~27
         36        DO_ICALL                                         $28     
         37        SUB                                              ~29     $25, $28
         38        MUL                                              ~30     !3, 2
         39        IS_EQUAL                                         ~31     ~29, ~30
         40        BOOL                                             ~23     ~31
         41    > > JMPZ                                                     ~23, ->44
   13    42    >   ASSIGN                                                   !2, '3+Consecutive+dates+found'
   14    43      > JMP                                                      ->47
   10    44    >   PRE_INC                                                  !4
         45    >   IS_SMALLER                                               !4, !5
         46      > JMPNZ                                                    ~34, ->15
   18    47    >   NOP                                                      
         48        FAST_CONCAT                                      ~35     'Result%3A+', !2
         49        ECHO                                                     ~35
         50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.97 ms | 1400 KiB | 15 Q