3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time_intervals = "00:00-23:59"; $time_to_check = "2014-05-08 23:58:00"; $time_intervals = preg_split('/[\;]+/', $time_intervals); //separates the intervals by ; $time_valid = false; $i = 0; $time_to_check = strtotime(date('H:i', strtotime($time_to_check))); foreach ($time_intervals as $time_interval): $time = preg_split('/[\-]+/', $time_interval); if (($time_to_check >= strtotime($time[0])) && ($time_to_check <= strtotime($time[1]))): $time_valid = true; endif; endforeach; var_dump($time_valid);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 42
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 39
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 41
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 41
Branch analysis from position: 39
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/nMUj3
function name:  (null)
number of ops:  47
compiled vars:  !0 = $time_intervals, !1 = $time_to_check, !2 = $time_valid, !3 = $i, !4 = $time_interval, !5 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '00%3A00-23%3A59'
    4     1        ASSIGN                                                   !1, '2014-05-08+23%3A58%3A00'
    6     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5B%5C%3B%5D%2B%2F'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !0, $8
    8     7        ASSIGN                                                   !2, <false>
    9     8        ASSIGN                                                   !3, 0
   10     9        INIT_FCALL                                               'strtotime'
         10        INIT_FCALL                                               'date'
         11        SEND_VAL                                                 'H%3Ai'
         12        INIT_FCALL                                               'strtotime'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $12     
         15        SEND_VAR                                                 $12
         16        DO_ICALL                                         $13     
         17        SEND_VAR                                                 $13
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !1, $14
   12    20      > FE_RESET_R                                       $16     !0, ->42
         21    > > FE_FETCH_R                                               $16, !4, ->42
   13    22    >   INIT_FCALL                                               'preg_split'
         23        SEND_VAL                                                 '%2F%5B%5C-%5D%2B%2F'
         24        SEND_VAR                                                 !4
         25        DO_ICALL                                         $17     
         26        ASSIGN                                                   !5, $17
   15    27        INIT_FCALL                                               'strtotime'
         28        FETCH_DIM_R                                      ~19     !5, 0
         29        SEND_VAL                                                 ~19
         30        DO_ICALL                                         $20     
         31        IS_SMALLER_OR_EQUAL                              ~21     $20, !1
         32      > JMPZ_EX                                          ~21     ~21, ->39
         33    >   INIT_FCALL                                               'strtotime'
         34        FETCH_DIM_R                                      ~22     !5, 1
         35        SEND_VAL                                                 ~22
         36        DO_ICALL                                         $23     
         37        IS_SMALLER_OR_EQUAL                              ~24     !1, $23
         38        BOOL                                             ~21     ~24
         39    > > JMPZ                                                     ~21, ->41
   17    40    >   ASSIGN                                                   !2, <true>
   12    41    > > JMP                                                      ->21
         42    >   FE_FREE                                                  $16
   22    43        INIT_FCALL                                               'var_dump'
         44        SEND_VAR                                                 !2
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.84 ms | 1400 KiB | 21 Q