3v4l.org

run code in 300+ PHP versions simultaneously
<?php function setting($v) { $db = [ 'opening_time_Sunday' => '10:30', 'closing_time_Sunday' => '00:00', 'opening_time_Monday' => '09:30', 'closing_time_Monday' => '01:30', 'opening_time_Tuesday' => '09:30', 'closing_time_Tuesday' => '01:30', 'opening_time_Wednesday' => '09:30', 'closing_time_Wednesday' => '01:30', 'opening_time_Thursday' => '09:30', 'closing_time_Thursday' => '01:30', 'opening_time_Friday' => '09:30', 'closing_time_Friday' => '23:00', 'opening_time_Saturday' => '10:30', 'closing_time_Saturday' => '00:00', ]; return $db[$v]; } function Today($dateString) { $currentDate = new \DateTimeImmutable($dateString); if (in_array($currentDate->format('N'), [2, 3, 4, 5])) { //check current time is not beyond the threshold //Monday = 1 and Sunday = 7 | Thursday = 4 $closedDate = $currentDate->setTime(1, 30, 00); if ($currentDate < $closedDate) { //change the date to display to day prior $currentDate = $currentDate->sub(new \DateInterval('P1D')); } } $today = $currentDate->format('l'); $start = setting('opening_time_' . $today); // Select value from settings table $end = setting('closing_time_' . $today); // Select value from settings table return $today . ': ' . $start . " - " . $end; } $dates = []; for ($i=0;$i<7;$i++) { $date = \date_create('2018-10-08'); if ($i > 0) { $date->modify('+' . $i . ' day'); } $dates[$date->format('l')] = [ '00:15' => Today($date->setTime(0, 15)->format('Y-m-d H:i:s')), '23:00' => Today($date->setTime(23, 0, 0)->format('Y-m-d H:i:s')) ]; } echo "Day \t|\t00:15:00\t\t\t|\t23:00:00\n"; foreach($dates as $day => $times) { echo "$day \t|\t{$times['00:15']} \t|\t{$times['23:00']}\n"; }

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.130.0000.00818.39
8.3.120.0060.00320.78
8.3.110.0100.00020.94
8.3.100.0030.01316.97
8.3.90.0040.00426.77
8.3.80.0030.00618.43
8.3.70.0040.01116.88
8.3.60.0070.01318.68
8.3.50.0080.00717.43
8.3.40.0110.00719.10
8.3.30.0040.01118.88
8.3.20.0080.00018.85
8.3.10.0020.00521.93
8.3.00.0000.00821.90
8.2.250.0090.00016.63
8.2.240.0050.00317.57
8.2.230.0110.00722.58
8.2.220.0080.00024.06
8.2.210.0070.01126.77
8.2.200.0060.00317.00
8.2.190.0140.00416.88
8.2.180.0090.00616.75
8.2.170.0040.01119.22
8.2.160.0070.01122.96
8.2.150.0090.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00921.05
8.2.120.0040.00426.35
8.2.110.0060.00321.03
8.2.100.0080.00417.97
8.2.90.0060.00617.92
8.2.80.0060.00318.17
8.2.70.0000.00818.15
8.2.60.0080.00018.28
8.2.50.0030.00518.10
8.2.40.0000.00819.29
8.2.30.0040.00419.34
8.2.20.0000.00818.18
8.2.10.0000.00818.32
8.2.00.0090.00017.90
8.1.300.0150.00417.69
8.1.290.0000.01218.88
8.1.280.0090.00625.92
8.1.270.0040.00420.33
8.1.260.0030.00626.35
8.1.250.0070.00028.09
8.1.240.0090.00022.41
8.1.230.0090.00322.67
8.1.220.0030.00617.80
8.1.210.0040.00419.01
8.1.200.0070.00317.59
8.1.190.0060.00317.64
8.1.180.0030.00618.10
8.1.170.0110.00018.71
8.1.160.0000.00719.00
8.1.150.0000.00719.05
8.1.140.0030.00520.71
8.1.130.0000.00820.41
8.1.120.0040.00417.71
8.1.110.0040.00417.74
8.1.100.0040.00417.70
8.1.90.0050.00217.77
8.1.80.0060.00317.69
8.1.70.0000.00817.65
8.1.60.0040.00417.77
8.1.50.0030.00617.70
8.1.40.0030.00517.66
8.1.30.0050.00317.80
8.1.20.0030.00617.87
8.1.10.0040.00417.68
8.1.00.0050.00317.77
8.0.300.0060.00319.75
8.0.290.0040.00416.88
8.0.280.0030.00318.52
8.0.270.0000.00717.30
8.0.260.0030.00320.35
8.0.250.0000.00717.14
8.0.240.0090.00017.28
8.0.230.0040.00217.14
8.0.220.0070.00017.09
8.0.210.0050.00217.04
8.0.200.0000.00817.17
8.0.190.0050.00317.17
8.0.180.0030.00517.18
8.0.170.0000.00917.19
8.0.160.0040.00417.25
8.0.150.0060.00317.16
8.0.140.0040.00417.04
8.0.130.0050.00013.47
8.0.120.0040.00417.07
8.0.110.0000.00717.22
8.0.100.0040.00417.08
8.0.90.0050.00217.07
8.0.80.0110.00517.20
8.0.70.0000.00816.95
8.0.60.0080.00017.08
8.0.50.0000.00817.05
8.0.30.0060.01117.22
8.0.20.0100.01017.46
8.0.10.0000.00817.36
8.0.00.0110.00817.17
7.4.330.0050.00015.55
7.4.320.0000.00616.62
7.4.300.0000.00716.74
7.4.290.0050.00516.73
7.4.280.0060.00316.80
7.4.270.0070.00016.74
7.4.260.0040.00416.72
7.4.250.0070.00016.71
7.4.240.0080.00016.65
7.4.230.0000.00816.54
7.4.220.0040.00416.63
7.4.210.0070.00916.78
7.4.200.0000.00816.80
7.4.160.0110.00616.74
7.4.140.0110.01017.86
7.4.130.0230.00016.89
7.4.120.0090.01016.74
7.4.110.0120.01216.77
7.4.100.0140.00716.87
7.4.90.0130.00516.77
7.4.80.0050.01519.39
7.4.70.0080.01316.86
7.4.60.0040.01216.77
7.4.50.0130.00616.84
7.4.40.0030.01416.89
7.4.10.0070.01115.07
7.4.00.0100.00715.13
7.3.330.0000.00613.44
7.3.320.0000.00613.57
7.3.310.0050.00316.63
7.3.300.0030.00316.61
7.3.290.0000.00716.58
7.3.280.0120.00316.54
7.3.260.0090.01116.66
7.3.240.0110.00716.79
7.3.230.0070.01016.65
7.3.210.0030.01316.63
7.3.200.0110.00616.86
7.3.190.0140.00316.65
7.3.180.0050.01116.52
7.3.170.0030.01316.84
7.3.160.0120.01516.88
7.3.130.0100.00615.08
7.3.120.0070.00915.26
7.3.110.0080.01115.14
7.3.100.0070.00715.13
7.3.90.0110.00515.07
7.3.80.0040.00914.93
7.3.70.0050.00815.15
7.3.60.0040.00614.96
7.3.50.0060.00815.05
7.3.40.0090.00414.99
7.3.30.0070.00415.13
7.3.20.0040.01016.71
7.3.10.0040.00616.87
7.3.00.0090.00717.00
7.2.330.0090.01017.04
7.2.320.0060.01216.88
7.2.310.0030.01517.04
7.2.300.0070.01017.04
7.2.290.0100.01316.96
7.2.260.0090.00815.40
7.2.250.0040.01115.13
7.2.240.0050.00915.45
7.2.230.0030.00915.18
7.2.220.0080.00615.31
7.2.210.0070.00515.10
7.2.200.0030.01215.37
7.2.190.0070.00815.34
7.2.180.0050.00815.25
7.2.170.0060.00815.40
7.2.160.0070.00315.06
7.2.150.0070.00717.01
7.2.140.0060.00617.23
7.2.130.0050.01017.06
7.2.120.0070.00517.01
7.2.110.0030.01017.06
7.2.100.1120.00416.44
7.2.90.0410.01216.43
7.2.80.1010.01316.31
7.2.70.0970.01116.60
7.2.60.1130.00716.56
7.2.50.1100.01116.48
7.2.40.1040.00816.61
7.2.30.1100.01016.53
7.2.20.1310.00716.55
7.2.10.1270.01016.50
7.2.00.1220.00516.64
7.1.330.0090.00515.91
7.1.320.0060.00515.89
7.1.310.0050.00816.14
7.1.300.0050.00715.98
7.1.290.0080.00616.03
7.1.280.0050.01016.11
7.1.270.0080.00616.00
7.1.260.0040.00715.82
7.1.250.0080.00715.79
7.1.240.0000.01215.79
7.1.230.0070.00916.09
7.1.220.0100.00915.40
7.1.210.0190.00915.28
7.1.200.0940.00915.36
7.1.190.1090.00615.35
7.1.180.1170.00715.48
7.1.170.1120.00815.51
7.1.160.1090.00515.31
7.1.150.1220.00715.41
7.1.140.1180.00615.36
7.1.130.1250.00815.49
7.1.120.1310.00515.29
7.1.110.1100.01115.40
7.1.100.1100.00915.38
7.1.90.1140.00615.24
7.1.80.1080.00715.40
7.1.70.1030.00715.43
7.1.60.1150.01021.33
7.1.50.1240.01221.36
7.1.40.1650.00721.38
7.1.30.1380.00821.25
7.1.20.1410.01221.42
7.1.10.1360.01115.33
7.1.00.1180.00815.29
7.0.330.0030.01015.46
7.0.320.0060.00615.50
7.0.310.0040.00515.62
7.0.300.0070.00715.54
7.0.290.0030.00615.60
7.0.280.0070.00715.76
7.0.270.0090.00715.64
7.0.260.0110.00315.46
7.0.250.0070.00315.46
7.0.240.0000.01215.70
7.0.230.0040.01115.71
7.0.220.0050.01015.51
7.0.210.0020.00815.70
7.0.200.0060.01015.63
7.0.190.0070.00815.75
7.0.180.0080.00515.56
7.0.170.0030.00815.64
7.0.160.0020.01115.46
7.0.150.0080.00615.55
7.0.140.0040.01015.54
7.0.130.0040.01015.36
7.0.120.0070.00515.55
7.0.110.0020.01215.70
7.0.100.0050.00615.60
7.0.90.0030.00915.30
7.0.80.0060.00615.67
7.0.70.0080.00615.50
7.0.60.0080.00515.45
7.0.50.0050.00515.52
7.0.40.0020.00713.69
7.0.30.0050.00813.60
7.0.20.0040.00913.52
7.0.10.0060.00813.59
7.0.00.0020.00913.65
5.6.400.0070.00914.43
5.6.390.0040.00714.48
5.6.380.0070.00614.65
5.6.370.0120.00214.70
5.6.360.0030.01014.90
5.6.350.0050.00814.87
5.6.340.0050.00914.69
5.6.330.0050.01114.38
5.6.320.0050.00914.65
5.6.310.0050.00814.55
5.6.300.0090.00514.64
5.6.290.0030.00914.60
5.6.280.0030.01014.54
5.6.270.0070.00914.65
5.6.260.0060.00314.65
5.6.250.0020.00914.58
5.6.240.0050.01014.69
5.6.230.0080.00414.45
5.6.220.0070.00814.52
5.6.210.0070.00714.59
5.6.200.0050.00914.68
5.6.190.0050.00914.63
5.6.180.0060.00614.45
5.6.170.0100.00314.77
5.6.160.0060.00714.63
5.6.150.0070.00714.50
5.6.140.0050.00914.72
5.6.130.0040.01114.51
5.6.120.0060.00614.63
5.6.110.0080.00414.69
5.6.100.0060.00614.64
5.6.90.0100.00514.50
5.6.80.0110.00614.56
5.6.70.0040.01114.40
5.6.60.0060.00614.30
5.6.50.0080.00514.48
5.6.40.0070.00714.48
5.6.30.0050.00714.57
5.6.20.0050.01114.59
5.6.10.0090.00514.56
5.6.00.0050.01114.48

preferences:
45.86 ms | 403 KiB | 5 Q