3v4l.org

run code in 300+ PHP versions simultaneously
<?php function RS_GET_CLOSEST_DATE_WITH_DAYNAME($day_name, $format = 'Y-m-d H:i:s') { $day_name = ucfirst($day_name); if(date('l', time()) == $day_name) { return date($format, time()); } else if(abs(time()-strtotime('next '.$day_name)) < abs(time()-strtotime('last '.$day_name))) { return date($format, strtotime('next '.$day_name)); } else { return date($format, strtotime('last '.$day_name)); } } echo RS_GET_CLOSEST_DATE_WITH_DAYNAME('Monday');

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)
7.2.60.0030.00617.14
7.2.00.0030.00919.40
7.1.200.0030.00916.16
7.1.100.0030.00918.49
7.1.70.0140.00017.08
7.1.60.0100.01619.40
7.1.50.0100.01017.17
7.1.00.0070.07322.42
7.0.200.0000.00717.03
7.0.140.0030.07022.00
7.0.120.0000.03322.14
7.0.80.0670.06020.03
7.0.70.0570.08319.94
7.0.60.0430.05719.89
7.0.50.0630.08320.35
7.0.40.0100.08020.09
7.0.30.0000.08720.08
7.0.20.0070.05720.14
7.0.10.0030.08320.14
7.0.00.0030.08020.07
5.6.280.0030.07320.78
5.6.230.0070.06720.63
5.6.220.0000.05020.67
5.6.210.0130.07020.59
5.6.200.0100.07321.05
5.6.190.0070.08721.03
5.6.180.0030.04321.11
5.6.170.0100.08321.11
5.6.160.0000.08020.95
5.6.150.0070.04720.94
5.6.140.0070.08321.09
5.6.130.0100.08721.04
5.6.120.0100.05720.94
5.6.110.0070.08020.93
5.6.100.0100.05021.05
5.6.90.0070.06020.94
5.6.80.0070.03720.40
5.6.70.0070.05320.45
5.6.60.0030.06720.43
5.6.50.0030.07720.41
5.6.40.0070.08020.39
5.6.30.0200.06020.30
5.6.20.0100.07320.39
5.6.10.0170.05720.32
5.6.00.0100.04320.41
5.5.370.0070.08020.49
5.5.360.0070.06320.56
5.5.350.0000.09320.38
5.5.340.0070.04020.90
5.5.330.0070.08320.83
5.5.320.0070.07320.80
5.5.310.0100.07720.88
5.5.300.0100.07720.93
5.5.290.0100.07320.89
5.5.280.0070.04020.87
5.5.270.0030.09020.63
5.5.260.0130.04020.72
5.5.250.0100.08020.59
5.5.240.0100.08320.30
5.5.230.0100.07720.29
5.5.220.0100.06720.25
5.5.210.0200.05320.20
5.5.200.0100.07320.26
5.5.190.0170.03720.24
5.5.180.0070.08320.27
5.5.160.0070.07320.27
5.5.150.0170.07320.28
5.5.140.0070.08020.14
5.5.130.0130.07020.22
5.5.120.0000.08019.99
5.5.110.0070.07020.07
5.5.100.0070.04720.15
5.5.90.0170.06320.09
5.5.80.0030.07720.16
5.5.70.0100.07020.14
5.5.60.0100.07319.94
5.5.50.0000.07720.05
5.5.40.0070.04319.93
5.5.30.0100.06720.09
5.5.20.0030.05720.14
5.5.10.0030.04720.07
5.5.00.0030.04720.11
5.4.450.0030.05319.38
5.4.440.0170.07719.23
5.4.430.0170.06719.53
5.4.420.0170.06319.22
5.4.410.0100.04019.28
5.4.400.0000.05019.13
5.4.390.0100.05719.03
5.4.380.0070.05719.09
5.4.370.0130.07319.05
5.4.360.0100.07019.09
5.4.350.0030.08319.04
5.4.340.0030.06718.94
5.4.320.0100.07719.07
5.4.310.0130.05719.05
5.4.300.0070.04318.90
5.4.290.0030.06319.04
5.4.280.0070.06318.95
5.4.270.0100.05719.09
5.4.260.0100.07319.13
5.4.250.0200.06319.04
5.4.240.0030.08018.94
5.4.230.0070.07719.11
5.4.220.0030.07719.00
5.4.210.0030.07019.20
5.4.200.0070.08018.90
5.4.190.0070.08018.94
5.4.180.0030.05319.06
5.4.170.0070.05019.04
5.4.160.0130.07019.20
5.4.150.0100.04719.02
5.4.140.0100.07016.41
5.4.130.0030.07016.21
5.4.120.0170.05316.42
5.4.110.0030.03716.47
5.4.100.0170.06016.43
5.4.90.0070.07316.39
5.4.80.0070.07016.42
5.4.70.0030.04316.41
5.4.60.0130.06316.37
5.4.50.0070.07316.48
5.4.40.0030.04316.38
5.4.30.0170.06316.49
5.4.20.0070.07016.35
5.4.10.0070.03716.33
5.4.00.0030.04015.94
5.3.290.0030.05014.63
5.3.280.0030.05314.66
5.3.270.0030.06014.70
5.3.260.0030.06014.74
5.3.250.0030.06014.67
5.3.240.0100.03714.57
5.3.230.0030.06314.61
5.3.220.0170.07314.63
5.3.210.0070.05314.57
5.3.200.0030.08014.57
5.3.190.0030.05014.49
5.3.180.0030.07714.55
5.3.170.0130.06314.51
5.3.160.0070.05014.49
5.3.150.0030.03714.55
5.3.140.0070.06714.58
5.3.130.0000.04314.51
5.3.120.0070.04314.50
5.3.110.0030.07314.54
5.3.100.0100.07014.14
5.3.90.0000.04314.04
5.3.80.0170.07013.94
5.3.70.0130.06313.99
5.3.60.0130.07014.03
5.3.50.0030.07314.00
5.3.40.0070.03713.93
5.3.30.0030.07713.83
5.3.20.0070.06313.70
5.3.10.0070.03013.70
5.3.00.0100.05013.61
5.2.170.0030.06011.14
5.2.160.0100.03711.07
5.2.150.0030.06311.07
5.2.140.0100.04711.24
5.2.130.0030.03011.20
5.2.120.0000.03011.15
5.2.110.0130.05011.19
5.2.100.0100.05711.11
5.2.90.0100.05711.09
5.2.80.0100.05011.12
5.2.70.0030.04011.01
5.2.60.0000.06711.08
5.2.50.0030.03011.16
5.2.40.0030.03311.10
5.2.30.0030.03310.96
5.2.20.0030.03710.95
5.2.10.0070.05710.86
5.2.00.0100.02710.66
5.1.60.0100.0409.98
5.1.50.0070.0479.84
5.1.40.0070.05310.07
5.1.30.0070.03710.20
5.1.20.0000.05310.38
5.1.10.0070.05310.06
5.1.00.0030.03010.17
5.0.50.0070.0478.59
5.0.40.0070.0378.51
5.0.30.0070.0538.31
5.0.20.0000.0378.27
5.0.10.0030.0378.17
5.0.00.0070.0508.00
4.4.90.0000.0277.18
4.4.80.0000.0207.18
4.4.70.0000.0177.18
4.4.60.0000.0177.18
4.4.50.0000.0177.18
4.4.40.0070.0437.18
4.4.30.0030.0277.18
4.4.20.0030.0207.18
4.4.10.0030.0337.18
4.4.00.0070.0537.18
4.3.110.0000.0377.18
4.3.100.0070.0237.18
4.3.90.0000.0307.18
4.3.80.0130.0407.18
4.3.70.0030.0307.18
4.3.60.0030.0177.18
4.3.50.0030.0137.18
4.3.40.0000.0237.18
4.3.30.0000.0177.18
4.3.20.0070.0337.18
4.3.10.0000.0337.18
4.3.00.0030.0277.18

preferences:
43.45 ms | 401 KiB | 5 Q