3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/Toronto'); $start_day = 'tue'; $start_time = 181300; $end_day = 'fri'; $end_time = 134500; $startDate = DateTime::createFromFormat ( 'D His', $start_day . ' '. $start_time); $endDate = DateTime::createFromFormat ( 'D His', $end_day . ' '. $end_time); $startHour = $startDate->format('G'); //24-hour format of an hour without leading zeros $startDay = $startDate->format('N'); //numeric representation of the day of the week $endHour = $endDate->format('G'); //24-hour format of an hour without leading zeros $endDay = $endDate->format('N'); //numeric representation of the day of the week //We Need to check the time is between Tuesday 6PM ( 2 and 18 for $startDay and $startHour respectively ) to Friday 6PM ( ( 5 and 18 for $endDay and $endHour respectively )) if ( $startDay >= 2 && $endDay <= 5 && $startHour >= 18 and $endHour <= 18 ) { echo 'Within Time Range'; } else { echo 'Outside Range'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 39, Position 2 = 41
Branch analysis from position: 39
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
2 jumps found. (Code = 46) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 50
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 44
Branch analysis from position: 41
filename:       /in/aSoc4
function name:  (null)
number of ops:  52
compiled vars:  !0 = $start_day, !1 = $start_time, !2 = $end_day, !3 = $end_time, !4 = $startDate, !5 = $endDate, !6 = $startHour, !7 = $startDay, !8 = $endHour, !9 = $endDay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'America%2FToronto'
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, 'tue'
    5     4        ASSIGN                                                   !1, 181300
    7     5        ASSIGN                                                   !2, 'fri'
    8     6        ASSIGN                                                   !3, 134500
   11     7        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          8        SEND_VAL                                                 'D+His'
          9        CONCAT                                           ~15     !0, '+'
         10        CONCAT                                           ~16     ~15, !1
         11        SEND_VAL                                                 ~16
         12        DO_FCALL                                      0  $17     
         13        ASSIGN                                                   !4, $17
   12    14        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         15        SEND_VAL                                                 'D+His'
         16        CONCAT                                           ~19     !2, '+'
         17        CONCAT                                           ~20     ~19, !3
         18        SEND_VAL                                                 ~20
         19        DO_FCALL                                      0  $21     
         20        ASSIGN                                                   !5, $21
   14    21        INIT_METHOD_CALL                                         !4, 'format'
         22        SEND_VAL_EX                                              'G'
         23        DO_FCALL                                      0  $23     
         24        ASSIGN                                                   !6, $23
   15    25        INIT_METHOD_CALL                                         !4, 'format'
         26        SEND_VAL_EX                                              'N'
         27        DO_FCALL                                      0  $25     
         28        ASSIGN                                                   !7, $25
   18    29        INIT_METHOD_CALL                                         !5, 'format'
         30        SEND_VAL_EX                                              'G'
         31        DO_FCALL                                      0  $27     
         32        ASSIGN                                                   !8, $27
   19    33        INIT_METHOD_CALL                                         !5, 'format'
         34        SEND_VAL_EX                                              'N'
         35        DO_FCALL                                      0  $29     
         36        ASSIGN                                                   !9, $29
   22    37        IS_SMALLER_OR_EQUAL                              ~31     2, !7
         38      > JMPZ_EX                                          ~31     ~31, ->41
         39    >   IS_SMALLER_OR_EQUAL                              ~32     !9, 5
         40        BOOL                                             ~31     ~32
         41    > > JMPZ_EX                                          ~31     ~31, ->44
         42    >   IS_SMALLER_OR_EQUAL                              ~33     18, !6
         43        BOOL                                             ~31     ~33
         44    > > JMPZ_EX                                          ~31     ~31, ->47
         45    >   IS_SMALLER_OR_EQUAL                              ~34     !8, 18
         46        BOOL                                             ~31     ~34
         47    > > JMPZ                                                     ~31, ->50
   23    48    >   ECHO                                                     'Within+Time+Range'
   22    49      > JMP                                                      ->51
   25    50    >   ECHO                                                     'Outside+Range'
   26    51    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
259.83 ms | 1007 KiB | 14 Q