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' => '9:00 AM - 12:00 AM', 'tue' => '9:00 AM - 12:00 AM', 'wed' => '9:00 AM - 12:00 AM', 'thu' => '9:00 AM - 12:00 AM', 'fri' => '9:00 AM - 1:00 AM', 'sat' => '9:00 AM - 1:00 PM, 2:00 PM - 1:00 AM', 'sun' => 'closed' }; // 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)
5.4.260.3130.03719.08
5.4.250.3670.03719.08
5.4.240.3530.03319.22
5.4.230.3300.04019.09
5.4.220.3500.04019.05
5.4.210.3570.03318.97
5.4.200.3500.03719.21
5.4.190.3630.03018.86
5.4.180.3530.03318.84
5.4.170.3630.04018.98
5.4.160.3730.04318.93
5.4.150.3600.03018.96
5.4.140.3400.03316.41
5.4.130.3400.03716.34
5.4.120.3670.03016.28
5.4.110.4230.03316.56
5.4.100.4270.04316.26
5.4.90.4400.03316.61
5.4.80.3430.03316.44
5.4.70.3370.03716.57
5.4.60.3630.03716.34
5.4.50.3300.03316.34
5.4.40.3700.04016.42
5.4.30.3430.03016.37
5.4.20.3630.03716.42
5.4.10.3500.03016.53
5.4.00.3770.03715.76
5.3.280.3630.04014.54
5.3.270.3630.03714.44
5.3.260.4070.03314.53
5.3.250.3600.04014.46
5.3.240.3930.04014.51
5.3.230.4300.04014.53
5.3.220.3700.03314.52
5.3.210.5100.02014.41
5.3.200.4000.04314.50
5.3.190.5400.04014.43
5.3.180.3770.03714.47
5.3.170.3930.03014.51
5.3.160.3570.03014.53
5.3.150.3370.03714.43
5.3.140.3700.03314.51
5.3.130.3570.04314.64
5.3.120.3370.04314.39
5.3.110.3500.03314.48
5.3.100.3530.03013.99
5.3.90.3800.03313.87
5.3.80.3430.04013.81
5.3.70.3800.03714.11
5.3.60.3470.03313.85
5.3.50.3900.03713.99
5.3.40.4670.03313.93
5.3.30.3400.03713.78
5.3.20.4200.04013.52
5.3.10.3570.03013.75
5.3.00.3170.03013.68
5.2.170.2930.03311.30
5.2.160.2970.02710.99
5.2.150.3100.03011.16
5.2.140.2630.03011.05
5.2.130.3600.02711.14
5.2.120.2970.03010.95
5.2.110.2600.02711.14
5.2.100.2830.03311.28
5.2.90.3070.03010.95
5.2.80.3070.02310.93
5.2.70.3030.02710.95
5.2.60.3200.02710.88
5.2.50.3230.03010.95
5.2.40.3030.02310.83
5.2.30.3430.03310.82
5.2.20.2730.03010.86
5.2.10.2470.03010.94
5.2.00.2800.03010.69
5.1.60.2530.02710.16
5.1.50.2430.0279.90
5.1.40.2400.02710.02
5.1.30.3000.03010.31
5.1.20.2600.03310.39
5.1.10.2330.02310.14
5.1.00.2430.02710.04
5.0.50.1130.0208.63
5.0.40.1200.0178.39
5.0.30.1270.0278.28
5.0.20.1270.0178.35
5.0.10.1100.0208.39
5.0.00.1200.0278.30
4.4.90.1100.0178.28
4.4.80.0930.0138.28
4.4.70.1130.0138.28
4.4.60.1130.0178.28
4.4.50.1170.0178.28
4.4.40.1300.0238.28
4.4.30.1330.0208.28
4.4.20.1130.0208.28
4.4.10.1230.0138.28
4.4.00.1200.0278.28
4.3.110.1200.0178.28
4.3.100.1270.0178.28
4.3.90.1230.0138.28
4.3.80.1170.0238.28
4.3.70.1000.0178.28
4.3.60.1030.0178.28
4.3.50.1730.0178.28
4.3.40.1530.0308.28
4.3.30.0700.0138.28
4.3.20.0770.0178.28
4.3.10.0730.0178.28
4.3.00.0670.0178.28

preferences:
142.8 ms | 1394 KiB | 7 Q