3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Based on the following business hours: * (Note : I setup the hours for each day if they carry-over) * everyday is open from 09:00 AM - 12:00 AM * Sun/Sat open extra from 12:00 AM - 01:00 AM */ $storeSchedule = [ 'Sun' => ['12:00 AM' => '01:00 AM', '09:00 AM' => '12:00 AM'], 'Mon' => ['09:00 AM' => '12:00 AM'], 'Tue' => ['09:00 AM' => '12:00 AM'], 'Wed' => ['09:00 AM' => '12:00 AM'], 'Thu' => ['09:00 AM' => '12:00 AM'], 'Fri' => ['09:00 AM' => '12:00 AM'], 'Sat' => ['02:00 AM' => '12:00 PM'] ]; // current OR user supplied UNIX timestamp $timestamp = time(); // default status $status = 'closed'; // get current time object $currentTime = (new DateTime())->setTimestamp($timestamp); // loop through time ranges for current day foreach ($storeSchedule[date('D', $timestamp)] as $startTime => $endTime) { // create time objects from start/end times $startTime = DateTime::createFromFormat('h:i A', $startTime); $endTime = DateTime::createFromFormat('h:i A', $endTime); // check if current time is within a range if (($startTime < $currentTime) && ($currentTime < $endTime)) { $status = 'open'; break; } } echo "We are currently: $status";

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)
7.4.00.0100.00915.28
7.3.120.0060.01215.02
7.3.110.0130.00515.04
7.3.100.0080.00715.20
7.3.90.0070.00915.07
7.3.80.0070.00814.81
7.3.70.0050.01014.94
7.3.60.0060.01015.10
7.3.50.0030.01114.94
7.3.40.0080.00515.01
7.3.30.0000.01115.05
7.3.20.0090.00216.70
7.3.10.0050.00716.79
7.3.00.0080.00416.77
7.2.250.0100.00715.29
7.2.240.0100.00815.25
7.2.230.0060.00815.15
7.2.220.0050.01015.38
7.2.210.0080.00514.99
7.2.200.0100.00315.15
7.2.190.0100.00515.33
7.2.180.0030.01015.30
7.2.170.0060.00815.14
7.2.00.0030.00919.62
7.1.330.0060.00815.83
7.1.320.0060.00815.77
7.1.310.0020.01315.77
7.1.300.0080.00715.98
7.1.290.0040.00715.93
7.1.280.0080.00515.65
7.1.270.0070.00615.96
7.1.260.0050.00616.04
7.1.100.0030.01018.22
7.1.70.0030.00517.31
7.1.60.0150.00919.82
7.1.50.0100.00717.18
7.1.00.0030.03322.36
7.0.200.0050.00816.80
7.0.140.0000.07022.11
7.0.100.0470.07320.02
7.0.90.0330.05719.88
7.0.80.0470.07719.93
7.0.70.0430.07319.97
7.0.60.0330.07719.98
7.0.50.0530.06320.40
7.0.40.0100.08019.99
7.0.30.0100.08320.07
7.0.20.0100.08320.14
7.0.10.0070.08020.10
7.0.00.0030.08719.99
5.6.280.0000.07721.10
5.6.250.0100.07720.75
5.6.240.0070.05020.66
5.6.230.0070.07320.67
5.6.220.0100.08020.58
5.6.210.0100.08020.56
5.6.200.0100.07720.94
5.6.190.0000.07321.04
5.6.180.0170.07020.93
5.6.170.0130.04721.05
5.6.160.0070.08020.91
5.6.150.0070.08321.02
5.6.140.0070.04721.02
5.6.130.0030.05320.93
5.6.120.0100.05721.04
5.6.110.0100.08020.95
5.6.100.0030.04721.06
5.6.90.0030.04020.99
5.6.80.0030.04020.39
5.6.70.0030.04020.55
5.6.60.0100.03320.54
5.6.50.0100.03720.49
5.6.40.0000.04320.36
5.6.30.0000.05020.42
5.6.20.0100.06020.40
5.6.10.0070.03320.37
5.6.00.0030.04720.37
5.5.380.0130.08720.42
5.5.370.0030.04020.54
5.5.360.0100.08320.43
5.5.350.0130.07720.46
5.5.340.0070.08020.76
5.5.330.0070.08020.89
5.5.320.0030.05020.89
5.5.310.0130.04320.83
5.5.300.0030.05320.88
5.5.290.0100.06720.86
5.5.280.0100.04720.83
5.5.270.0100.07320.77
5.5.260.0030.04720.89
5.5.250.0030.04020.69
5.5.240.0030.04020.29
5.5.230.0030.04020.28
5.5.220.0100.03320.28
5.5.210.0070.03720.29
5.5.200.0070.04020.16
5.5.190.0000.05320.27
5.5.180.0070.04020.15
5.5.160.0100.03020.18
5.5.150.0100.04320.18
5.5.140.0030.05020.11
5.5.130.0030.03720.10
5.5.120.0170.02720.17
5.5.110.0000.04320.09
5.5.100.0070.04320.10
5.5.90.0130.03020.09
5.5.80.0000.05020.05
5.5.70.0070.04020.10
5.5.60.0000.04320.06
5.5.50.0070.03719.96
5.5.40.0100.03320.06
5.5.30.0030.04020.15
5.5.20.0030.04020.15
5.5.10.0100.04020.04
5.5.00.0030.04720.10
5.4.450.0130.07019.27
5.4.440.0000.08319.13
5.4.430.0030.04019.10
5.4.420.0100.04319.39
5.4.410.0030.03719.25
5.4.400.0030.03319.05
5.4.390.0000.04018.76
5.4.380.0000.04018.79
5.4.370.0070.03319.06
5.4.360.0130.07019.10
5.4.350.0070.05718.96
5.4.340.0100.06019.05
5.4.320.0030.05018.96
5.4.310.0070.03319.23
5.4.300.0100.04719.03
5.4.290.0070.03319.22
5.4.280.0070.04019.11
5.4.270.0000.04019.00
5.4.260.0000.04018.81
5.4.250.0030.03719.09
5.4.240.0000.04019.13
5.4.230.0000.04018.94
5.4.220.0070.03318.97
5.4.210.0000.04018.80
5.4.200.0030.03718.93
5.4.190.0030.03719.04
5.4.180.0030.03719.02
5.4.170.0030.04318.96
5.4.160.0100.05018.88
5.4.150.0030.04018.79
5.4.140.0030.03016.41
5.4.130.0030.03716.39
5.4.120.0000.03716.38
5.4.110.0030.06716.50
5.4.100.0030.06716.32
5.4.90.0070.04316.29
5.4.80.0030.07716.38
5.4.70.0100.06016.25
5.4.60.0100.05316.34
5.4.50.0000.05316.19
5.4.40.0070.08016.41
5.4.30.0100.06716.40
5.4.20.0100.04016.20
5.4.10.0100.06316.25
5.4.00.0100.04715.70
5.3.290.0000.04714.52
5.3.280.0100.04014.59
5.3.270.0030.04314.61
5.3.260.0030.03714.60
5.3.250.0130.04714.59
5.3.240.0100.04314.44
5.3.230.0000.04714.46
5.3.220.0000.04314.51
5.3.210.0030.07314.50
5.3.200.0170.06314.53
5.3.190.0030.04714.51
5.3.180.0070.07314.56
5.3.170.0100.06314.55
5.3.160.0070.04314.39
5.3.150.0130.06314.47
5.3.140.0000.05014.51
5.3.130.0070.05014.38
5.3.120.0100.07314.51
5.3.110.0070.07014.49
5.3.100.0000.04014.03
5.3.90.0030.04713.86
5.3.80.0070.07013.97
5.3.70.0100.07013.92
5.3.60.0100.07314.00
5.3.50.0070.06713.93
5.3.40.0070.07013.97
5.3.30.0100.04713.87
5.3.20.0030.07713.68
5.3.10.0070.04013.52
5.3.00.0070.07313.63
5.2.170.0030.06312.68
5.2.160.0000.07012.68
5.2.150.0100.05712.68
5.2.140.0070.03312.68
5.2.130.0070.06712.68
5.2.120.0100.04012.68
5.2.110.0030.06712.68
5.2.100.0100.06012.68
5.2.90.0030.03312.68
5.2.80.0030.06012.68
5.2.70.0030.05012.68
5.2.60.0000.07012.68
5.2.50.0000.04012.68
5.2.40.0100.05712.68
5.2.30.0030.04712.68
5.2.20.0000.03712.68
5.2.10.0070.06012.68
5.2.00.0130.05312.68
5.1.60.0030.05712.68
5.1.50.0000.06012.68
5.1.40.0030.05312.68
5.1.30.0000.06012.68
5.1.20.0030.05312.68
5.1.10.0070.05012.68
5.1.00.0070.03012.68
5.0.50.0030.04712.68
5.0.40.0100.03712.68
5.0.30.0100.06012.68
5.0.20.0000.05012.68
5.0.10.0030.03712.68
5.0.00.0000.06312.68
4.4.90.0000.02012.68
4.4.80.0000.03712.68
4.4.70.0030.03712.68
4.4.60.0030.03312.68
4.4.50.0000.03312.68
4.4.40.0070.04312.68
4.4.30.0030.03012.68
4.4.20.0000.03712.68
4.4.10.0030.02712.68
4.4.00.0000.05712.68
4.3.110.0030.03712.68
4.3.100.0000.03712.68
4.3.90.0030.03312.68
4.3.80.0000.04312.68
4.3.70.0130.02312.68
4.3.60.0000.02312.68
4.3.50.0030.01712.68
4.3.40.0000.03012.68
4.3.30.0000.03712.68
4.3.20.0070.02312.68
4.3.10.0030.03012.68
4.3.00.0030.03012.68

preferences:
62.95 ms | 401 KiB | 5 Q