3v4l.org

run code in 300+ PHP versions simultaneously
<?php // -------- PHP STORE HOURS --------- // ---------- Version 1.1 ----------- // -------- BY CORY ETZKORN --------- // -------- coryetzkorn.com --------- // -------- EDIT FOLLOWING SECTION ONLY --------- // Set your timezone (codes listed at http://php.net/manual/en/timezones.php) // Delete the following line if you've already defined a timezone elsewhere. date_default_timezone_set('Europe/Stockholm'); // Define daily open hours. Must be in 24-hour format, separated by dash. $time_range_mon = '11:00-20:30'; $time_range_tue = '11:00-20:30'; $time_range_wed = '11:00-20:30'; $time_range_thu = '11:00-20:30'; $time_range_fri = '11:00-21:30'; $time_range_sat = '11:00-21:30'; $time_range_sun = '12:00-19:30'; // OPTIONAL: Output current day's open hours $echo_daily_hours = false; // Switch to FALSE to hide numerical display of current hours $time_output = 'g a'; // Enter custom time output format (options listed here: http://php.net/manual/en/function.date.php) $time_separator = ' - '; // Choose how to indicate range (i.e XX - XX, XX to XX, XX until XX) // -------- END EDITING -------- // Gets current day of week $status_today = date("D"); // Gets current time of day in 00:00 format $current_time = date("G:i"); // Makes current time of day computer-readable $current_time_x = strtotime($current_time); // Builds an array, assigning user-defined time ranges to each day of week $all_days = array("Mon" => $time_range_mon, "Tue" => $time_range_tue, "Wed" => $time_range_wed, "Thu" => $time_range_thu, "Fri" => $time_range_fri, "Sat" => $time_range_sat, "Sun" => $time_range_sun); foreach ($all_days as &$each_day) { $each_day = explode("-", $each_day); $each_day[0] = strtotime($each_day[0]); $each_day[1] = strtotime($each_day[1]); } // Defines array of possible days of week $week_days = array("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"); // Compares current day of week to possible days of week and determines open vs closed output based on current day and time. foreach ($week_days as &$each_week_day) { if ($status_today == $each_week_day) { echo ''; if (($all_days[$each_week_day][0] <= $current_time_x) && ($all_days[$each_week_day][1] >= $current_time_x)) { } else { header( 'Location: http://www.bristolhotel.com/pizzeria/offlinepizza.php' ) ; } } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 34, Position 2 = 53
Branch analysis from position: 34
2 jumps found. (Code = 126) Position 1 = 35, Position 2 = 53
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 53
2 jumps found. (Code = 125) Position 1 = 56, Position 2 = 74
Branch analysis from position: 56
2 jumps found. (Code = 126) Position 1 = 57, Position 2 = 74
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 73
Branch analysis from position: 59
2 jumps found. (Code = 46) Position 1 = 64, Position 2 = 68
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 70
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 68
Branch analysis from position: 73
Branch analysis from position: 74
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 74
Branch analysis from position: 53
filename:       /in/YYe3Y
function name:  (null)
number of ops:  76
compiled vars:  !0 = $time_range_mon, !1 = $time_range_tue, !2 = $time_range_wed, !3 = $time_range_thu, !4 = $time_range_fri, !5 = $time_range_sat, !6 = $time_range_sun, !7 = $echo_daily_hours, !8 = $time_output, !9 = $time_separator, !10 = $status_today, !11 = $current_time, !12 = $current_time_x, !13 = $all_days, !14 = $each_day, !15 = $week_days, !16 = $each_week_day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'Europe%2FStockholm'
          2        DO_ICALL                                                 
   15     3        ASSIGN                                                   !0, '11%3A00-20%3A30'
   16     4        ASSIGN                                                   !1, '11%3A00-20%3A30'
   17     5        ASSIGN                                                   !2, '11%3A00-20%3A30'
   18     6        ASSIGN                                                   !3, '11%3A00-20%3A30'
   19     7        ASSIGN                                                   !4, '11%3A00-21%3A30'
   20     8        ASSIGN                                                   !5, '11%3A00-21%3A30'
   21     9        ASSIGN                                                   !6, '12%3A00-19%3A30'
   25    10        ASSIGN                                                   !7, <false>
   26    11        ASSIGN                                                   !8, 'g+a'
   27    12        ASSIGN                                                   !9, '+-+'
   32    13        INIT_FCALL                                               'date'
         14        SEND_VAL                                                 'D'
         15        DO_ICALL                                         $28     
         16        ASSIGN                                                   !10, $28
   35    17        INIT_FCALL                                               'date'
         18        SEND_VAL                                                 'G%3Ai'
         19        DO_ICALL                                         $30     
         20        ASSIGN                                                   !11, $30
   37    21        INIT_FCALL                                               'strtotime'
         22        SEND_VAR                                                 !11
         23        DO_ICALL                                         $32     
         24        ASSIGN                                                   !12, $32
   40    25        INIT_ARRAY                                       ~34     !0, 'Mon'
         26        ADD_ARRAY_ELEMENT                                ~34     !1, 'Tue'
         27        ADD_ARRAY_ELEMENT                                ~34     !2, 'Wed'
         28        ADD_ARRAY_ELEMENT                                ~34     !3, 'Thu'
         29        ADD_ARRAY_ELEMENT                                ~34     !4, 'Fri'
         30        ADD_ARRAY_ELEMENT                                ~34     !5, 'Sat'
         31        ADD_ARRAY_ELEMENT                                ~34     !6, 'Sun'
         32        ASSIGN                                                   !13, ~34
   41    33      > FE_RESET_RW                                      $36     !13, ->53
         34    > > FE_FETCH_RW                                              $36, !14, ->53
   42    35    >   INIT_FCALL                                               'explode'
         36        SEND_VAL                                                 '-'
         37        SEND_VAR                                                 !14
         38        DO_ICALL                                         $37     
         39        ASSIGN                                                   !14, $37
   43    40        INIT_FCALL                                               'strtotime'
         41        FETCH_DIM_R                                      ~40     !14, 0
         42        SEND_VAL                                                 ~40
         43        DO_ICALL                                         $41     
         44        ASSIGN_DIM                                               !14, 0
         45        OP_DATA                                                  $41
   44    46        INIT_FCALL                                               'strtotime'
         47        FETCH_DIM_R                                      ~43     !14, 1
         48        SEND_VAL                                                 ~43
         49        DO_ICALL                                         $44     
         50        ASSIGN_DIM                                               !14, 1
         51        OP_DATA                                                  $44
   41    52      > JMP                                                      ->34
         53    >   FE_FREE                                                  $36
   48    54        ASSIGN                                                   !15, <array>
   51    55      > FE_RESET_RW                                      $46     !15, ->74
         56    > > FE_FETCH_RW                                              $46, !16, ->74
   52    57    >   IS_EQUAL                                                 !10, !16
         58      > JMPZ                                                     ~47, ->73
   53    59    >   ECHO                                                     ''
   54    60        FETCH_DIM_R                                      ~48     !13, !16
         61        FETCH_DIM_R                                      ~49     ~48, 0
         62        IS_SMALLER_OR_EQUAL                              ~50     ~49, !12
         63      > JMPZ_EX                                          ~50     ~50, ->68
         64    >   FETCH_DIM_R                                      ~51     !13, !16
         65        FETCH_DIM_R                                      ~52     ~51, 1
         66        IS_SMALLER_OR_EQUAL                              ~53     !12, ~52
         67        BOOL                                             ~50     ~53
         68    > > JMPZ                                                     ~50, ->70
         69    > > JMP                                                      ->73
   57    70    >   INIT_FCALL                                               'header'
         71        SEND_VAL                                                 'Location%3A+http%3A%2F%2Fwww.bristolhotel.com%2Fpizzeria%2Fofflinepizza.php'
         72        DO_ICALL                                                 
   51    73    > > JMP                                                      ->56
         74    >   FE_FREE                                                  $46
   62    75      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.87 ms | 1409 KiB | 23 Q