3v4l.org

run code in 300+ PHP versions simultaneously
<?php $storeSchedule = [ 'Sun' => [['12:00' => '01:00', '10:00' => '12:00']], 'Mon' => [['09:00' => '12:00']], 'Tue' => [['09:00' => '12:00']], 'Wed' => [['09:00' => '12:00']], 'Thu' => [['09:00' => '12:00'], ['22:50' => '23:00']], 'Fri' => [['09:00' => '12:00']], 'Sat' => [['12:00' => '01:00', '09:00' => '12:00']] ]; $today = date("D"); $closed = Null; foreach($storeSchedule[$today] as $opentimes){ foreach($opentimes as $open => $close){ $now = time(); if($now > strtotime(date("Y-m-d" . $open)) && $now < strtotime(date("Y-m-d" . $close))){ echo "store open now"; $closed = false; }else if($now < strtotime(date("Y-m-d" . $open))){ echo "store will open at " . date("Y-m-d" . $open); $closed = false; }else{ // Store is closed if($closed !== false) $closed = true; } } } if($closed){ // Dump the next open time $opentime = Key($storeSchedule[date("D",strtotime($today)+86400)][0]); echo "store is closed and will open tomorrow " . $opentime . " and close " . $storeSchedule[date("D",strtotime($today)+86400)][0][$opentime]; }

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.4.80.0210.01018.96
8.4.40.0430.01117.86
7.4.00.0000.01815.04
7.3.120.0070.01415.18
7.3.110.0000.01815.26
7.3.100.0070.00715.08
7.3.90.0060.00615.36
7.3.80.0000.01415.38
7.3.70.0070.01115.17
7.3.60.0130.00315.21
7.3.50.0120.00415.11
7.3.40.0070.00714.84
7.3.30.0030.00915.08
7.3.20.0040.01216.77
7.3.10.0030.01317.07
7.3.00.0040.00817.02
7.2.250.0100.01014.98
7.2.240.0090.00915.45
7.2.230.0000.01615.36
7.2.220.0030.01015.52
7.2.210.0070.01015.65
7.2.200.0030.00615.43
7.2.190.0000.01115.27
7.2.180.0030.01015.40
7.2.170.0060.00915.34
7.2.120.0110.00416.77
7.2.110.0070.00716.91
7.2.100.0060.00616.79
7.2.90.0040.01216.67
7.2.80.0090.00816.77
7.2.70.0060.01217.01
7.2.60.0080.00417.18
7.2.50.0060.00917.18
7.2.40.0000.01816.68
7.2.30.0040.01417.24
7.2.20.0110.00317.08
7.2.10.0070.00717.23
7.2.00.0030.01417.22
7.1.330.0030.00915.98
7.1.320.0090.00316.07
7.1.310.0080.00815.98
7.1.300.0060.00616.00
7.1.290.0060.00616.16
7.1.280.0030.00716.16
7.1.270.0070.00716.13
7.1.260.0100.00715.86
7.1.240.0050.00816.11
7.1.230.0090.00615.80
7.1.220.0070.00715.80
7.1.210.0090.00616.06
7.1.200.0060.00915.94
7.1.190.0030.01316.03
7.1.180.0060.00915.85
7.1.170.0090.00616.07
7.1.160.0090.00615.91
7.1.150.0020.01316.04
7.1.140.0060.00615.82
7.1.130.0070.01015.71
7.1.120.0080.00816.16
7.1.110.0110.00516.07
7.1.100.0120.00315.88
7.1.90.0090.00615.80
7.1.80.0070.00715.93
7.1.70.0110.00615.86
7.1.60.0000.01215.89
7.1.50.0090.00616.00
7.1.40.0110.00415.78
7.1.30.0070.01015.87
7.1.20.0110.00515.98
7.1.10.0100.00715.55
7.1.00.0070.00715.89
5.6.380.0100.00314.38

preferences:
39.69 ms | 403 KiB | 5 Q