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'; $time_range_christmas = '12:00-14:30'; $time_range_newyears = '12:00-14: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"); $todays_date = date("d M"); if ($todays_date == "25 Dec"){ $status_today = "Christmas"; } if ($todays_date == "1 Jan"){ $status_today = "NewYears"; } // 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, "Christmas" => $time_range_christmas, "NewYears" => $time_range_newyears); 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", "Christmas", "NewYears"); // 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' ) ; } } } ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0000.01518.55
8.3.50.0080.01021.95
8.3.40.0070.00718.79
8.3.30.0060.00819.21
8.3.20.0050.00220.04
8.3.10.0080.00021.95
8.3.00.0040.00422.47
8.2.180.0120.00918.41
8.2.170.0110.00722.96
8.2.160.0070.00720.39
8.2.150.0080.00024.18
8.2.140.0030.00624.66
8.2.130.0000.00826.16
8.2.120.0000.00819.61
8.2.110.0030.00621.13
8.2.100.0080.00418.03
8.2.90.0030.00717.88
8.2.80.0090.00017.97
8.2.70.0040.00418.15
8.2.60.0050.00318.16
8.2.50.0040.00418.10
8.2.40.0000.00819.38
8.2.30.0040.00418.21
8.2.20.0040.00417.88
8.2.10.0080.00019.71
8.2.00.0040.00417.99
8.1.280.0060.00925.92
8.1.270.0060.00322.18
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00619.44
8.1.230.0030.01022.68
8.1.220.0050.00317.91
8.1.210.0040.00418.77
8.1.200.0050.00317.60
8.1.190.0030.00517.35
8.1.180.0030.00618.10
8.1.170.0080.00020.78
8.1.160.0040.00419.03
8.1.150.0030.00518.85
8.1.140.0040.00417.61
8.1.130.0000.00817.99
8.1.120.0070.00017.71
8.1.110.0030.00617.57
8.1.100.0000.00817.68
8.1.90.0000.00717.68
8.1.80.0020.00517.64
8.1.70.0040.00417.66
8.1.60.0060.00317.66
8.1.50.0050.00317.57
8.1.40.0040.00417.71
8.1.30.0040.00417.70
8.1.20.0000.00817.77
8.1.10.0090.00017.75
8.1.00.0040.00417.55
8.0.300.0040.00419.94
8.0.290.0080.00016.88
8.0.280.0000.00818.55
8.0.270.0030.00317.27
8.0.260.0000.00616.93
8.0.250.0070.00017.12
8.0.240.0070.00017.07
8.0.230.0020.00517.08
8.0.220.0040.00417.02
8.0.210.0040.00417.00
8.0.200.0040.00417.14
8.0.190.0040.00417.07
8.0.180.0030.00617.18
8.0.170.0080.00017.16
8.0.160.0040.00417.05
8.0.150.0040.00417.05
8.0.140.0050.00217.05
8.0.130.0060.00013.52
8.0.120.0060.00317.13
8.0.110.0000.00717.13
8.0.100.0030.00517.09
8.0.90.0050.00317.03
8.0.80.0040.01117.18
8.0.70.0000.00717.04
8.0.60.0040.00416.99
8.0.50.0030.00517.07
8.0.30.0080.01517.32
8.0.20.0140.00617.40
8.0.10.0050.00317.23
8.0.00.0080.01216.89
7.4.330.0030.00315.21
7.4.320.0000.00616.85
7.4.300.0030.00316.64
7.4.290.0040.00416.77
7.4.280.0030.00616.61
7.4.270.0000.00716.61
7.4.260.0070.00016.78
7.4.250.0030.00516.65
7.4.240.0020.00616.65
7.4.230.0030.00316.77
7.4.220.0180.00016.61
7.4.210.0100.00516.75
7.4.200.0040.00416.46
7.4.190.0040.00416.65
7.4.160.0070.01016.87
7.4.150.0100.00717.40
7.4.140.0110.01017.86
7.4.130.0070.01216.67
7.4.120.0130.00416.71
7.4.110.0100.00716.61
7.4.100.0150.00316.63
7.4.90.0160.00416.78
7.4.80.0100.01319.39
7.4.70.0100.00716.71
7.4.60.0040.01216.70
7.4.50.0000.00916.52
7.4.40.0060.00622.77
7.4.30.0070.01116.85
7.4.00.0060.00915.24
7.3.330.0050.00013.31
7.3.320.0030.00313.39
7.3.310.0000.00816.32
7.3.300.0000.00716.41
7.3.290.0060.01016.37
7.3.280.0090.00816.49
7.3.270.0030.01317.40
7.3.260.0140.00316.70
7.3.250.0080.01016.63
7.3.240.0040.01216.50
7.3.230.0130.00316.66
7.3.210.0100.01316.80
7.3.200.0060.01619.39
7.3.190.0130.00916.70
7.3.180.0150.00616.70
7.3.170.0040.01216.77
7.3.160.0090.00616.54
7.3.120.0030.01015.02
7.3.110.0070.00815.04
7.3.100.0090.00614.83
7.3.90.0040.01114.75
7.3.80.0040.00715.24
7.3.70.0110.00315.21
7.3.60.0070.00715.09
7.3.50.0130.00315.20
7.3.40.0090.00614.91
7.3.30.0000.01114.67
7.3.20.0150.00016.94
7.3.10.0000.01416.86
7.3.00.0150.00016.96
7.2.330.0100.00717.05
7.2.320.0120.00617.03
7.2.310.0190.00416.65
7.2.300.0130.00316.97
7.2.290.0130.00317.05
7.2.240.0040.00715.21
7.2.230.0080.00415.39
7.2.220.0040.00815.50
7.2.210.0090.00915.24
7.2.200.0030.00915.36
7.2.190.0030.01315.41
7.2.180.0090.00315.37
7.2.170.0000.01115.13
7.2.160.0040.01415.15
7.2.150.0070.00716.82
7.2.140.0030.01317.04
7.2.130.0090.00616.82
7.2.120.0030.01317.32
7.2.110.0090.00917.21
7.2.100.0130.00317.13
7.2.90.0060.00917.21
7.2.80.0030.01317.05
7.2.70.0030.01317.15
7.2.60.0040.01117.20
7.2.50.0000.01217.02
7.2.40.0100.00717.14
7.2.30.0060.00917.25
7.2.20.0120.00617.15
7.2.10.0030.00917.08
7.2.00.0040.00818.29
7.1.330.0080.00816.00
7.1.320.0070.01015.96
7.1.310.0030.01016.12
7.1.300.0090.00615.80
7.1.290.0090.00616.00
7.1.280.0060.00915.96
7.1.270.0060.00916.10
7.1.260.0030.00616.02
7.1.250.0030.01216.22
7.1.100.0110.00517.86
7.1.70.0040.00617.16
7.1.60.0090.01519.82
7.1.50.0280.00634.79
7.1.00.0070.07322.45
7.0.200.0060.00617.01
7.0.140.0000.07722.22
7.0.100.0130.07319.98
7.0.90.0030.08719.96
7.0.80.0070.08019.97
7.0.70.0100.07719.96
7.0.60.0030.06319.91
7.0.50.0230.07020.43
7.0.40.0030.04320.03
7.0.30.0130.08020.11
7.0.20.0070.08720.00
7.0.10.0100.04720.07
7.0.00.0070.07320.01
5.6.280.0000.09021.09
5.6.250.0030.08720.73
5.6.240.0070.08320.64
5.6.230.0100.05320.67
5.6.220.0070.07320.72
5.6.210.0070.08320.46
5.6.200.0130.07320.95
5.6.190.0030.04321.04
5.6.180.0100.07021.02
5.6.170.0070.06320.96
5.6.160.0070.04721.04
5.6.150.0130.04021.18
5.6.140.0100.08321.12
5.6.130.0100.05021.08
5.6.120.0070.09021.04
5.6.110.0200.07321.04
5.6.100.0170.07321.03
5.6.90.0070.07321.04
5.6.80.0030.05720.41
5.6.70.0200.06720.32
5.6.60.0030.04020.46
5.6.50.0070.05720.43
5.6.40.0070.04020.50
5.6.30.0000.04020.43
5.6.20.0100.03320.32
5.6.10.0070.03720.46
5.6.00.0000.06320.43
5.5.380.0100.07320.51
5.5.370.0000.09020.37
5.5.360.0030.09020.39
5.5.350.0070.08020.43
5.5.340.0100.04320.93
5.5.330.0030.05320.90
5.5.320.0030.05320.82
5.5.310.0000.05020.89
5.5.300.0070.07320.65
5.5.290.0100.07020.80
5.5.280.0030.08320.88
5.5.270.0170.06720.83
5.5.260.0030.08720.64
5.5.250.0000.07020.62
5.5.240.0000.04720.28
5.5.230.0100.03320.22
5.5.220.0030.04020.31
5.5.210.0000.04320.27
5.5.200.0070.03720.20
5.5.190.0000.04320.14
5.5.180.0000.05020.28
5.5.160.0030.04320.16
5.5.150.0130.05720.09
5.5.140.0030.06020.09
5.5.130.0030.04320.18
5.5.120.0070.03720.29
5.5.110.0030.04020.09
5.5.100.0070.06320.09
5.5.90.0070.04320.10
5.5.80.0000.04020.07
5.5.70.0000.04020.07
5.5.60.0070.03720.10
5.5.50.0070.03720.11
5.5.40.0030.03720.14
5.5.30.0130.03019.99
5.5.20.0000.04020.12
5.5.10.0030.04020.04
5.5.00.0100.03320.05
5.4.450.0030.04019.30
5.4.440.0000.08319.46
5.4.430.0030.08019.28
5.4.420.0170.06319.55
5.4.410.0170.06319.00
5.4.400.0100.06318.99
5.4.390.0000.04718.81
5.4.380.0100.03718.98
5.4.370.0000.04718.96
5.4.360.0130.03319.03
5.4.350.0030.03719.06
5.4.340.0130.03018.92
5.4.320.0030.03719.12
5.4.310.0070.03719.06
5.4.300.0030.03719.24
5.4.290.0030.03718.89
5.4.280.0030.03718.89
5.4.270.0000.03719.08
5.4.260.0030.03719.03
5.4.250.0070.04719.13
5.4.240.0030.04319.14
5.4.230.0070.03318.77
5.4.220.0100.03318.80
5.4.210.0030.03718.80
5.4.200.0070.03319.14
5.4.190.0030.04719.06
5.4.180.0070.03319.21
5.4.170.0070.03319.11
5.4.160.0030.03718.88
5.4.150.0000.04019.02
5.4.140.0070.03316.43
5.4.130.0030.03316.17
5.4.120.0030.04016.32
5.4.110.0000.04316.29
5.4.100.0030.03716.23
5.4.90.0100.03316.26
5.4.80.0030.03316.26
5.4.70.0100.07016.34
5.4.60.0070.04316.40
5.4.50.0070.04316.33
5.4.40.0100.05016.30
5.4.30.0100.03016.18
5.4.20.0170.06016.24
5.4.10.0030.05316.18
5.4.00.0030.07715.80
5.3.290.0000.04014.54
5.3.280.0030.06014.59
5.3.270.0000.04014.58
5.3.260.0030.03714.63
5.3.250.0070.03014.61
5.3.240.0030.04014.63
5.3.230.0070.03014.46
5.3.220.0000.04014.57
5.3.210.0100.03314.44
5.3.200.0030.03714.56
5.3.190.0030.03714.58
5.3.180.0000.04714.55
5.3.170.0100.05714.59
5.3.160.0000.04014.56
5.3.150.0100.05714.59
5.3.140.0000.05314.39
5.3.130.0200.06314.57
5.3.120.0030.08014.54
5.3.110.0070.05714.48
5.3.100.0100.06314.05
5.3.90.0000.08314.02
5.3.80.0070.07014.02
5.3.70.0030.07313.99
5.3.60.0030.08014.00
5.3.50.0030.07713.96
5.3.40.0070.07313.97
5.3.30.0070.03713.87
5.3.20.0070.07013.57
5.3.10.0070.06013.66
5.3.00.0000.07713.59
5.2.170.0030.06311.09
5.2.160.0030.03010.98
5.2.150.0030.03711.15
5.2.140.0030.04011.13
5.2.130.0030.05710.96
5.2.120.0000.05711.14
5.2.110.0030.06311.12
5.2.100.0030.06011.12
5.2.90.0000.06711.10
5.2.80.0030.04011.05
5.2.70.0030.03011.16
5.2.60.0000.03011.00
5.2.50.0070.02311.04
5.2.40.0000.03711.05
5.2.30.0070.05710.99
5.2.20.0100.05710.97
5.2.10.0030.06010.73
5.2.00.0000.05010.74
5.1.60.0000.0609.89
5.1.50.0030.05710.07
5.1.40.0030.02710.02
5.1.30.0070.04010.39
5.1.20.0030.05710.34
5.1.10.0100.04010.17
5.1.00.0030.03010.17
5.0.50.0070.0438.61
5.0.40.0030.0478.45
5.0.30.0070.0638.26
5.0.20.0030.0238.33
5.0.10.0100.0408.22
5.0.00.0100.0538.21
4.4.90.0030.0207.05
4.4.80.0000.0337.05
4.4.70.0070.0307.05
4.4.60.0030.0207.05
4.4.50.0000.0207.05
4.4.40.0000.0507.05
4.4.30.0000.0377.05
4.4.20.0030.0307.05
4.4.10.0070.0177.05
4.4.00.0030.0537.05
4.3.110.0070.0237.05
4.3.100.0000.0337.05
4.3.90.0030.0337.05
4.3.80.0030.0277.05
4.3.70.0000.0337.05
4.3.60.0000.0307.05
4.3.50.0030.0377.05
4.3.40.0030.0507.05
4.3.30.0000.0377.05
4.3.20.0030.0277.05
4.3.10.0030.0337.05
4.3.00.0000.0377.05

preferences:
44.89 ms | 401 KiB | 5 Q