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 = [ 'Mon' => ['09:00 AM' => '05:00 PM'], 'Tue' => ['09:00 AM' => '05:00 PM'], 'Wed' => ['09:00 AM' => '05:00 PM'], 'Thu' => ['09:00 AM' => '05:00 PM'], 'Fri' => ['09:00 AM' => '05:00 PM'], ]; // current OR user supplied UNIX timestamp $timestamp = 1526731200; // 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)
8.3.60.0110.00418.55
8.3.50.0070.00717.94
8.3.40.0140.00018.92
8.3.30.0110.00418.92
8.3.20.0080.00019.15
8.3.10.0000.00821.75
8.3.00.0080.00019.76
8.2.180.0150.00317.00
8.2.170.0070.00722.96
8.2.160.0070.00720.52
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0050.00319.95
8.2.120.0080.00026.35
8.2.110.0000.00920.47
8.2.100.0110.00318.13
8.2.90.0000.00818.29
8.2.80.0070.00319.89
8.2.70.0060.00318.15
8.2.60.0060.00317.93
8.2.50.0050.00318.22
8.2.40.0030.00521.06
8.2.30.0070.00019.57
8.2.20.0040.00418.09
8.2.10.0000.00818.20
8.2.00.0040.00419.27
8.1.280.0100.00725.92
8.1.270.0040.00423.87
8.1.260.0000.00726.35
8.1.250.0030.00528.09
8.1.240.0070.00423.85
8.1.230.0030.00722.10
8.1.220.0000.00817.78
8.1.210.0080.00418.77
8.1.200.0050.00317.48
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0080.00018.66
8.1.160.0000.00719.04
8.1.150.0000.00919.02
8.1.140.0020.00517.66
8.1.130.0040.00419.09
8.1.120.0080.00317.68
8.1.110.0080.00017.72
8.1.100.0000.00717.72
8.1.90.0030.00717.68
8.1.80.0040.00417.60
8.1.70.0040.00417.68
8.1.60.0000.00817.71
8.1.50.0000.00717.67
8.1.40.0060.00617.63
8.1.30.0070.00017.67
8.1.20.0040.00417.77
8.1.10.0070.00017.75
8.1.00.0040.00417.65
8.0.300.0040.00420.04
8.0.290.0000.00716.88
8.0.280.0070.00018.54
8.0.270.0050.00317.34
8.0.260.0000.00617.35
8.0.250.0000.00617.23
8.0.240.0090.00017.13
8.0.230.0000.00717.27
8.0.220.0000.00817.20
8.0.210.0040.00417.24
8.0.200.0000.00617.18
8.0.190.0040.00417.21
8.0.180.0040.00417.28
8.0.170.0040.00417.13
8.0.160.0070.00017.22
8.0.150.0060.00317.11
8.0.140.0080.00017.04
8.0.130.0030.00313.54
8.0.120.0000.00817.14
8.0.110.0040.00417.04
8.0.100.0000.00817.06
8.0.90.0030.00317.29
8.0.80.0050.01117.18
8.0.70.0000.00817.21
8.0.60.0040.00417.29
8.0.50.0070.00017.12
8.0.30.0120.00817.40
8.0.20.0120.01017.52
8.0.10.0050.00317.30
8.0.00.0030.01417.04
7.4.330.0050.00016.70
7.4.320.0060.00016.66
7.4.300.0030.00316.76
7.4.290.0000.00716.75
7.4.280.0040.00416.62
7.4.270.0000.00916.68
7.4.260.0030.00316.59
7.4.250.0000.00716.58
7.4.240.0000.00716.77
7.4.230.0030.00316.67
7.4.220.0060.00316.69
7.4.210.0080.00916.73
7.4.200.0050.00316.66
7.4.160.0110.00616.68
7.4.140.0120.00617.86
7.4.130.0120.00616.84
7.4.120.0070.01016.82
7.4.110.0070.01016.58
7.4.100.0060.01016.72
7.4.90.0060.01616.81
7.4.80.0150.00919.39
7.4.70.0030.01316.60
7.4.60.0090.00616.72
7.4.50.0070.01016.77
7.4.40.0140.00716.74
7.4.00.0020.01415.18
7.3.330.0000.00613.39
7.3.320.0030.00313.46
7.3.310.0030.00716.42
7.3.300.0050.00216.50
7.3.290.0000.00816.39
7.3.280.0090.00616.45
7.3.260.0130.00616.75
7.3.240.0130.00316.67
7.3.230.0070.01116.73
7.3.210.0110.00916.94
7.3.200.0140.00716.43
7.3.190.0040.01216.73
7.3.180.0100.00716.51
7.3.170.0100.01216.54
7.3.160.0060.01016.74
7.3.120.0040.01415.18
7.3.110.0140.00315.29
7.3.100.0120.00315.11
7.3.90.0040.01115.25
7.3.80.0030.01014.74
7.3.70.0070.00315.01
7.3.60.0060.00614.76
7.3.50.0100.00715.05
7.3.40.0040.00815.10
7.3.30.0030.01215.20
7.3.20.0110.00316.57
7.3.10.0080.00616.73
7.3.00.0150.00316.81
7.2.330.0100.00716.69
7.2.320.0130.00616.86
7.2.310.0000.02116.98
7.2.300.0030.01316.62
7.2.290.0160.00616.62
7.2.250.0070.01015.03
7.2.240.0060.01315.13
7.2.230.0080.00815.39
7.2.220.0110.00614.93
7.2.210.0060.00315.23
7.2.200.0000.01614.93
7.2.190.0080.00815.15
7.2.180.0000.01715.29
7.2.170.0100.00715.17
7.2.160.0030.01314.97
7.2.150.0060.01017.18
7.2.140.0030.00616.99
7.2.130.0080.00817.14
7.2.120.0050.01216.94
7.2.110.0080.00817.16
7.2.100.0050.01216.90
7.2.90.0050.01017.08
7.2.80.0080.00917.13
7.2.70.0090.00516.91
7.2.60.0080.00716.95
7.2.50.0080.00417.02
7.2.40.0140.01017.34
7.2.30.0270.00917.29
7.2.20.0460.00617.40
7.2.10.0480.01017.29
7.2.00.0610.00717.12
7.1.330.0070.01016.00
7.1.320.0000.01415.95
7.1.310.0060.00915.98
7.1.300.0040.00416.01
7.1.290.0000.01215.59
7.1.280.0070.01015.72
7.1.270.0060.00616.15
7.1.260.0110.00616.15
7.1.250.0070.01015.94
7.1.240.0020.01015.70
7.1.230.0080.00615.80
7.1.220.0070.00915.81
7.1.210.0110.00615.92
7.1.200.0050.00815.59
7.1.190.0080.00715.96
7.1.180.0090.00515.69
7.1.170.0050.01215.65
7.1.160.0580.00716.37
7.1.150.0440.00816.24
7.1.140.0520.00816.25
7.1.130.0660.00716.06
7.1.120.0610.01016.31
7.1.110.0490.00616.11
7.1.100.0480.00716.09
7.1.90.0540.01016.15
7.1.80.0470.00616.11
7.1.70.0510.00915.96
7.1.60.0540.00921.75
7.1.50.0580.01021.54
7.1.40.0490.01121.57
7.1.30.0530.00921.61
7.1.20.0580.00921.43
7.1.10.0070.00915.68
7.1.00.0070.00815.61
7.0.330.0120.00515.59
7.0.320.0090.00315.68
7.0.310.0060.00615.43
7.0.300.0060.00315.59
7.0.290.0030.01415.52
7.0.280.0030.01315.58
7.0.270.0030.00915.65
7.0.260.0090.00915.62
7.0.250.0060.00615.77
7.0.240.0060.00615.75
7.0.230.0120.00415.45
7.0.220.0070.01115.70
7.0.210.0150.00015.69
7.0.200.0070.00715.75
7.0.190.0040.00415.33
7.0.180.0100.00315.64
7.0.170.0030.01015.65
7.0.160.0100.00315.66
7.0.150.0100.00315.55
7.0.140.0070.00415.44
7.0.130.0090.00315.75
7.0.120.0040.00715.66
7.0.110.0030.01015.52
7.0.100.0070.00715.64
7.0.90.0040.00715.38
7.0.80.0080.00315.64
7.0.70.0070.00715.51
7.0.60.0030.01015.49
7.0.50.0040.00815.70
7.0.40.0060.00613.77
7.0.30.0040.00713.71
7.0.20.0090.00313.55
7.0.10.0090.00613.55
7.0.00.0030.01213.58
5.6.400.0000.01614.50
5.6.390.0070.01114.44
5.6.380.0050.01014.50
5.6.370.0110.00014.69
5.6.360.0070.01014.34
5.6.350.0100.00714.86
5.6.340.0030.00914.36
5.6.330.0110.00414.54
5.6.320.0030.01314.77
5.6.310.0040.00714.48
5.6.300.0090.00314.68
5.6.290.0090.00614.52
5.6.280.0000.01814.63
5.6.270.0000.01414.71
5.6.260.0090.00614.55
5.6.250.0040.01214.61
5.6.240.0030.01014.53
5.6.230.0070.01014.80
5.6.220.0070.00714.41
5.6.210.0080.00314.64
5.6.200.0000.00914.41
5.6.190.0110.00414.18
5.6.180.0070.00714.42
5.6.170.0060.00314.22
5.6.160.0060.00314.83
5.6.150.0040.01114.55
5.6.140.0060.00914.41
5.6.130.0110.00414.48
5.6.120.0040.01214.37
5.6.110.0000.01114.36
5.6.100.0070.00714.53
5.6.90.0060.01014.36
5.6.80.0100.00014.72
5.6.70.0050.00514.48
5.6.60.0060.00614.32
5.6.50.0080.00414.43
5.6.40.0040.01114.22
5.6.30.0060.00914.67
5.6.20.0070.01014.29
5.6.10.0070.01014.30
5.6.00.0030.01014.29

preferences:
59.23 ms | 401 KiB | 5 Q