3v4l.org

run code in 300+ PHP versions simultaneously
<?php $times = array( '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' ); function compileHours($times, $timestamp) { $times = $times[strtolower(date('D',$timestamp))]; if(!strpos($times, '-')) return array(); $hours = explode(",", $times); $hours = array_map('explode', array_pad(array(),count($hours),'-'), $hours); $hours = array_map('array_map', array_pad(array(),count($hours),'strtotime'), $hours, array_pad(array(),count($hours),array_pad(array(),2,$timestamp))); end($hours); if ($hours[key($hours)][0] > $hours[key($hours)][1]) $hours[key($hours)][1] = strtotime('+1 day', $hours[key($hours)][1]); return $hours; } function isOpen($now, $times) { $open = 0; // time until closing in seconds or 0 if closed // merge opening hours of today and the day before $hours = array_merge(compileHours($times, strtotime('yesterday',$now)),compileHours($times, $now)); foreach ($hours as $h) { if ($now >= $h[0] and $now < $h[1]) { $open = $h[1] - $now; return $open; } } echo $open; }

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.0140.00016.63
8.3.50.0120.00921.87
8.3.40.0130.00318.57
8.3.30.0100.00318.57
8.3.20.0040.00420.34
8.3.10.0080.00023.48
8.3.00.0030.00717.38
8.2.180.0070.01118.29
8.2.170.0040.01122.96
8.2.160.0070.00720.39
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0060.00326.16
8.2.120.0030.00520.93
8.2.110.0120.00022.20
8.2.100.0120.00017.80
8.2.90.0030.00619.22
8.2.80.0080.00017.97
8.2.70.0050.00317.61
8.2.60.0000.00717.80
8.2.50.0050.00318.07
8.2.40.0040.00421.20
8.2.30.0040.00420.59
8.2.20.0040.00417.57
8.2.10.0040.00418.13
8.2.00.0000.00718.08
8.1.280.0060.00925.92
8.1.270.0030.00623.96
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00022.53
8.1.230.0090.00317.66
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.23
8.1.190.0050.00317.25
8.1.180.0080.00018.10
8.1.170.0000.00820.04
8.1.160.0000.00822.00
8.1.150.0000.00818.88
8.1.140.0050.00319.60
8.1.130.0030.00317.66
8.1.120.0000.00817.35
8.1.110.0070.00017.46
8.1.100.0040.00417.36
8.1.90.0040.00417.32
8.1.80.0000.00717.29
8.1.70.0030.00317.41
8.1.60.0040.00417.57
8.1.50.0000.00817.39
8.1.40.0050.00317.36
8.1.30.0060.00317.58
8.1.20.0040.00417.50
8.1.10.0030.00517.52
8.1.00.0040.00417.44
8.0.300.0000.00718.77
8.0.290.0000.00716.63
8.0.280.0030.00318.40
8.0.270.0100.00017.26
8.0.260.0000.00617.22
8.0.250.0070.00016.80
8.0.240.0030.00516.88
8.0.230.0060.00016.93
8.0.220.0070.00016.82
8.0.210.0030.00316.82
8.0.200.0000.00716.86
8.0.190.0000.00816.92
8.0.180.0040.00416.86
8.0.170.0000.00816.86
8.0.160.0050.00316.91
8.0.150.0000.00716.74
8.0.140.0050.00216.79
8.0.130.0000.00813.36
8.0.120.0000.00716.78
8.0.110.0000.00816.68
8.0.100.0030.00316.88
8.0.90.0080.00016.68
8.0.80.0060.01116.91
8.0.70.0040.00416.80
8.0.60.0000.00716.76
8.0.50.0040.00416.85
8.0.30.0070.01017.00
8.0.20.0150.00517.40
8.0.10.0040.00416.87
8.0.00.0080.01016.77
7.4.330.0050.00015.08
7.4.320.0030.00316.52
7.4.300.0000.00616.55
7.4.290.0000.00716.55
7.4.280.0060.00316.49
7.4.270.0030.00316.49
7.4.260.0040.00316.54
7.4.250.0070.00016.52
7.4.240.0030.00516.56
7.4.230.0000.00716.35
7.4.220.0150.00316.41
7.4.210.0110.00316.50
7.4.200.0050.00216.57
7.4.160.0090.00616.31
7.4.150.0100.00717.40
7.4.140.0110.01217.86
7.4.130.0060.01916.35
7.4.120.0070.01316.45
7.4.110.0100.00916.21
7.4.100.0110.00716.38
7.4.90.0120.00616.41
7.4.80.0140.00319.39
7.4.70.0150.00316.58
7.4.60.0130.00916.47
7.4.50.0050.00316.28
7.4.40.0090.01216.46
7.4.30.0100.00616.41
7.4.00.0060.00915.05
7.3.330.0000.00513.18
7.3.320.0000.00513.24
7.3.310.0000.00716.16
7.3.300.0000.00716.03
7.3.290.0090.00816.20
7.3.280.0080.01116.16
7.3.270.0070.01017.40
7.3.260.0110.00616.47
7.3.240.0110.00616.40
7.3.230.0130.00716.52
7.3.210.0080.00916.11
7.3.200.0000.01616.26
7.3.190.0080.00816.36
7.3.180.0120.00416.20
7.3.170.0060.00916.32
7.3.160.0120.00416.26
7.2.330.0090.00916.45
7.2.320.0070.01016.55
7.2.310.0000.01616.48
7.2.300.0060.01016.62
7.2.290.0070.01016.55
7.2.00.0030.01018.84
7.1.100.0070.00417.55
7.1.70.0040.00817.13
7.1.60.0100.01419.13
7.1.50.0060.00916.93
7.1.00.0070.07322.45
7.0.200.0160.00614.66
7.0.90.0070.04721.74
7.0.80.0200.03321.79
7.0.70.0070.08321.69
7.0.60.0100.07721.86
7.0.50.0070.07022.04
7.0.40.0030.09020.03
7.0.30.0000.06320.18
7.0.20.0000.09020.08
7.0.10.0070.06720.07
7.0.00.0130.04020.07
5.6.280.0000.04721.12
5.6.240.0100.09020.76
5.6.230.0030.08020.49
5.6.220.0170.07020.63
5.6.210.0100.07020.66
5.6.200.0030.06021.05
5.6.190.0100.08321.10
5.6.180.0000.09021.15
5.6.170.0000.08321.19
5.6.160.0000.06321.07
5.6.150.0100.06320.96
5.6.140.0100.08021.05
5.6.130.0030.08021.13
5.6.120.0100.05721.18
5.6.110.0030.04321.07
5.6.100.0170.07321.11
5.6.90.0100.07721.01
5.6.80.0030.08320.54
5.6.70.0070.07720.41
5.6.60.0070.08320.46
5.6.50.0100.09020.42
5.6.40.0030.07720.45
5.6.30.0030.08020.41
5.6.20.0000.07720.31
5.6.10.0070.07720.44
5.6.00.0100.07320.29
5.5.380.0070.06320.40
5.5.370.0030.08720.47
5.5.360.0070.08020.45
5.5.350.0100.08020.41
5.5.340.0130.07720.96
5.5.330.0100.04320.85
5.5.320.0100.09320.95
5.5.310.0070.05020.88
5.5.300.0100.07320.80
5.5.290.0170.05020.84
5.5.280.0100.08320.89
5.5.270.0070.04320.93
5.5.260.0200.05020.77
5.5.250.0170.06720.59
5.5.240.0100.06320.29
5.5.230.0130.06320.20
5.5.220.0100.07720.29
5.5.210.0070.04320.20
5.5.200.0070.07020.23
5.5.190.0100.07320.23
5.5.180.0030.06020.09
5.5.160.0100.05720.31
5.5.150.0100.07320.28
5.5.140.0030.08320.22
5.5.130.0030.04720.01
5.5.120.0030.08320.27
5.5.110.0030.05720.26
5.5.100.0070.06320.10
5.5.90.0130.04020.11
5.5.80.0030.04320.08
5.5.70.0100.07320.02
5.5.60.0030.07320.13
5.5.50.0100.06320.11
5.5.40.0030.07020.07
5.5.30.0070.08320.17
5.5.20.0000.06320.16
5.5.10.0100.05720.00
5.5.00.0030.07320.09
5.4.450.0100.07719.28
5.4.440.0070.06019.46
5.4.430.0170.07019.57
5.4.420.0170.06719.45
5.4.410.0130.06319.23
5.4.400.0070.08019.06
5.4.390.0030.06319.03
5.4.380.0030.07719.12
5.4.370.0070.04719.20
5.4.360.0030.07319.14
5.4.350.0070.07719.06
5.4.340.0070.06719.21
5.4.320.0070.07019.21
5.4.310.0100.04719.09
5.4.300.0070.08018.94
5.4.290.0070.04719.03
5.4.280.0000.08019.09
5.4.270.0070.07019.18
5.4.260.0000.08019.03
5.4.250.0000.06319.04
5.4.240.0030.04318.88
5.4.230.0030.07719.17
5.4.220.0030.08019.08
5.4.210.0070.04319.04
5.4.200.0030.08018.94
5.4.190.0070.07319.11
5.4.180.0030.07719.22
5.4.170.0130.06319.13
5.4.160.0030.04319.21
5.4.150.0030.08019.01
5.4.140.0130.06716.45
5.4.130.0100.06316.46
5.4.120.0130.06716.23
5.4.110.0100.06716.44
5.4.100.0130.07016.41
5.4.90.0100.06316.41
5.4.80.0270.05716.31
5.4.70.0100.07016.54
5.4.60.0030.07716.48
5.4.50.0070.07016.39
5.4.40.0100.06716.53
5.4.30.0070.07316.40
5.4.20.0130.06016.36
5.4.10.0000.07016.36
5.4.00.0100.07015.63

preferences:
37.85 ms | 401 KiB | 5 Q