3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sample1 = "2010-01-31"; $dnow = date("t",strtotime($sample1)); $dnext = date("t",strtotime($sample1 . " +1 month")); $dday = date("d",strtotime($sample1)); $output = date("Y-m-d",strtotime($sample1 . " +1 month")); echo '/' . $dnow . '/' . $dnext . '/' . $dday . '/'; if ($dnext < $dnow && $dnext < $dday) { $nextMonth = date("Y-m", strtotime($sample1)); $nextMonth = date("Y-m", strtotime($nextMonth . " +1 month")); $output = $nextMonth . '-' . $dnext; } echo $output; echo "\n"; $ts = strtotime('2010-01-31 +1 month'); echo date('Y-m-d', $ts); echo "\n"; $dt = new \DateTime('2010-01-31'); $dt->add(new \DateInterval('P1M')); echo $dt->format('Y-m-d'); echo "\n"; $ts = strtotime('2010-01-05 +1 month'); echo date('Y-m-d', $ts); echo "\n"; $dt = new \DateTime('2010-01-05'); $dt->add(new \DateInterval('P1M')); echo $dt->format('Y-m-d');

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.0070.01418.30
8.3.50.0100.00821.14
8.3.40.0110.00418.76
8.3.30.0090.00620.36
8.3.20.0060.00320.65
8.3.10.0080.00021.21
8.3.00.0030.00623.60
8.2.180.0030.01416.63
8.2.170.0120.00922.96
8.2.160.0070.00720.53
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00521.14
8.2.110.0090.00021.16
8.2.100.0070.00418.03
8.2.90.0100.00019.17
8.2.80.0030.00517.97
8.2.70.0000.00817.75
8.2.60.0000.00817.80
8.2.50.0050.00318.07
8.2.40.0080.00018.34
8.2.30.0040.00419.46
8.2.20.0040.00417.99
8.2.10.0060.00317.90
8.2.00.0040.00417.94
8.1.280.0180.00025.92
8.1.270.0080.00023.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0040.00421.40
8.1.230.0080.00317.64
8.1.220.0030.00617.91
8.1.210.0060.00318.77
8.1.200.0000.00917.73
8.1.190.0040.00417.48
8.1.180.0040.00418.10
8.1.170.0050.00818.61
8.1.160.0040.00418.98
8.1.150.0040.00418.96
8.1.140.0040.00417.70
8.1.130.0040.00417.89
8.1.120.0030.00517.79
8.1.110.0050.00217.75
8.1.100.0040.00417.64
8.1.90.0080.00017.81
8.1.80.0000.00717.78
8.1.70.0000.00717.75
8.1.60.0000.00817.85
8.1.50.0030.00617.59
8.1.40.0040.00417.77
8.1.30.0070.00017.82
8.1.20.0000.00917.86
8.1.10.0000.00817.82
8.1.00.0040.00417.81
8.0.300.0080.00018.77
8.0.290.0070.00017.00
8.0.280.0000.00718.61
8.0.270.0000.00917.43
8.0.260.0030.00317.11
8.0.250.0040.00417.22
8.0.240.0030.00717.22
8.0.230.0070.00017.22
8.0.220.0000.00717.21
8.0.210.0030.00717.16
8.0.200.0040.00417.11
8.0.190.0000.00817.27
8.0.180.0000.00717.16
8.0.170.0000.00717.13
8.0.160.0000.00817.17
8.0.150.0040.00417.01
8.0.140.0070.00317.00
8.0.130.0030.00313.54
8.0.120.0030.00617.02
8.0.110.0050.00217.18
8.0.100.0050.00317.22
8.0.90.0040.00417.30
8.0.80.0100.00717.16
8.0.70.0050.00217.18
8.0.60.0000.00817.25
8.0.50.0040.00417.07
8.0.30.0090.01017.38
8.0.20.0130.00617.48
8.0.10.0000.00717.14
8.0.00.0100.00817.05
7.4.330.0030.00315.09
7.4.320.0070.00016.74
7.4.300.0000.00616.83
7.4.290.0030.00816.75
7.4.280.0030.00316.81
7.4.270.0040.00416.83
7.4.260.0000.00513.43
7.4.250.0040.00416.71
7.4.240.0030.00316.59
7.4.230.0000.00716.62
7.4.220.0030.01516.82
7.4.210.0110.00616.83
7.4.200.0070.00016.55
7.4.190.0000.00816.79
7.4.160.0130.00416.93
7.4.150.0140.00317.40
7.4.140.0110.00917.86
7.4.130.0090.00816.72
7.4.120.0110.00616.88
7.4.110.0120.00616.70
7.4.100.0070.01116.80
7.4.90.0130.01016.70
7.4.80.0070.01019.39
7.4.70.0110.01116.79
7.4.60.0110.01216.80
7.4.50.0060.00316.72
7.4.40.0030.01322.77
7.4.30.0110.00616.88
7.4.00.0090.00915.41
7.3.330.0000.00513.36
7.3.320.0030.00213.31
7.3.310.0030.00316.53
7.3.300.0030.00316.50
7.3.290.0030.01316.44
7.3.280.0060.01016.49
7.3.270.0100.00717.40
7.3.260.0110.00718.24
7.3.250.0070.01316.75
7.3.240.0100.01016.89
7.3.230.0050.01117.05
7.3.210.0090.00916.67
7.3.200.0040.01319.39
7.3.190.0030.01316.85
7.3.180.0150.00416.49
7.3.170.0140.00316.45
7.3.160.0040.01816.38
7.3.120.0070.00715.23
7.3.110.0040.01115.27
7.3.100.0070.00715.05
7.3.90.0040.01114.99
7.3.80.0060.00314.95
7.3.70.0090.00614.91
7.3.60.0140.00015.02
7.3.50.0030.00614.84
7.3.40.0030.00615.00
7.3.30.0070.00715.16
7.3.20.0030.01016.89
7.3.10.0060.00616.98
7.3.00.0060.00617.09
7.2.330.0090.00916.84
7.2.320.0120.01216.76
7.2.310.0070.01317.03
7.2.300.0060.01116.72
7.2.290.0040.01217.11
7.2.240.0000.00815.57
7.2.230.0070.00715.53
7.2.220.0030.00715.26
7.2.210.0040.01215.22
7.2.200.0000.01215.25
7.2.190.0040.01115.33
7.2.180.0090.00615.34
7.2.170.0030.01015.53
7.2.160.0070.00715.23
7.2.150.0070.01016.95
7.2.140.0040.01117.28
7.2.130.0040.01217.14
7.2.120.0090.00617.23
7.2.110.0070.00417.32
7.2.100.0090.00616.91
7.2.90.0000.01817.39
7.2.80.0040.00817.16
7.2.70.0110.00417.16
7.2.60.0020.01517.23
7.2.50.0000.01417.23
7.2.40.0090.00617.27
7.2.30.0120.00617.38
7.2.20.0030.01217.28
7.2.10.0070.00717.05
7.2.00.0050.01118.52
7.1.330.0080.00315.72
7.1.320.0000.01416.19
7.1.310.0000.01115.94
7.1.300.0000.01416.10
7.1.290.0040.00815.96
7.1.280.0040.00715.98
7.1.270.0070.00715.89
7.1.260.0070.00716.02
7.1.250.0070.00715.79
7.1.200.0000.01415.81
7.1.100.0030.00618.17
7.1.70.0040.00417.38
7.1.60.0070.01319.17
7.1.50.0130.00617.38
7.1.00.0070.05722.58
7.0.200.0000.00716.99
7.0.140.0070.07022.05
7.0.100.0100.07719.94
7.0.90.0030.07719.89
7.0.80.0100.07319.92
7.0.70.0070.07320.02
7.0.60.0030.05719.94
7.0.50.0070.07320.34
7.0.40.0100.07320.10
7.0.30.0070.08320.05
7.0.20.0100.06020.13
7.0.10.0030.08319.99
7.0.00.0130.07720.10
5.6.280.0070.07021.12
5.6.250.0100.07020.63
5.6.240.0100.07720.70
5.6.230.0070.07720.54
5.6.220.0100.08020.66
5.6.210.0100.06320.46
5.6.200.0170.07020.95
5.6.190.0170.07321.17
5.6.180.0000.08720.96
5.6.170.0000.05320.99
5.6.160.0030.08721.05
5.6.150.0070.06021.02
5.6.140.0070.05021.09
5.6.130.0030.08721.14
5.6.120.0000.09321.02
5.6.110.0030.08720.95
5.6.100.0230.06321.09
5.6.90.0230.06721.06
5.6.80.0030.06720.34
5.6.70.0100.04020.46
5.6.60.0070.07720.39
5.6.50.0100.04320.41
5.6.40.0030.08720.50
5.6.30.0100.07020.38
5.6.20.0070.07720.46
5.6.10.0070.07020.40
5.6.00.0070.07720.39
5.5.380.0100.07020.50
5.5.370.0130.07720.54
5.5.360.0130.07020.34
5.5.350.0070.07720.38
5.5.340.0170.07320.74
5.5.330.0070.08320.77
5.5.320.0070.08320.90
5.5.310.0000.07020.78
5.5.300.0030.05020.92
5.5.290.0200.07020.84
5.5.280.0030.08020.72
5.5.270.0030.08320.91
5.5.260.0130.08320.92
5.5.250.0070.08020.55
5.5.240.0070.07320.27
5.5.230.0030.06720.30
5.5.220.0000.07720.30
5.5.210.0070.07320.17
5.5.200.0000.04720.27
5.5.190.0070.08020.23
5.5.180.0070.04320.17
5.5.160.0070.05020.23
5.5.150.0070.08020.19
5.5.140.0030.07320.09
5.5.130.0030.04320.12
5.5.120.0070.08020.23
5.5.110.0070.07320.14
5.5.100.0000.08720.17
5.5.90.0170.06720.07
5.5.80.0200.06320.07
5.5.70.0070.07720.02
5.5.60.0100.07320.07
5.5.50.0070.05020.07
5.5.40.0130.03020.05
5.5.30.0100.08020.14
5.5.20.0100.08020.09
5.5.10.0030.08320.12
5.5.00.0130.07020.03
5.4.450.0130.07319.56
5.4.440.0100.05719.14
5.4.430.0130.06719.13
5.4.420.0070.04319.43
5.4.410.0130.07019.16
5.4.400.0200.06019.13
5.4.390.0070.06719.14
5.4.380.0070.06719.12
5.4.370.0030.05719.01
5.4.360.0100.05719.12
5.4.350.0100.07319.10
5.4.340.0000.06319.06
5.4.320.0030.07718.81
5.4.310.0000.08319.12
5.4.300.0130.04319.12
5.4.290.0100.07018.81
5.4.280.0070.07319.05
5.4.270.0000.08319.03
5.4.260.0030.08318.80
5.4.250.0000.08019.14
5.4.240.0100.06019.06
5.4.230.0100.03718.80
5.4.220.0000.08318.94
5.4.210.0070.06719.09
5.4.200.0070.07019.07
5.4.190.0030.05719.05
5.4.180.0030.07318.77
5.4.170.0100.07319.12
5.4.160.0100.03719.09
5.4.150.0000.07318.94
5.4.140.0070.07316.39
5.4.130.0100.07016.32
5.4.120.0070.05016.44
5.4.110.0130.04716.41
5.4.100.0030.06316.31
5.4.90.0070.07016.41
5.4.80.0100.06016.25
5.4.70.0030.07016.48
5.4.60.0030.06716.24
5.4.50.0070.07316.38
5.4.40.0100.07016.28
5.4.30.0070.05016.18
5.4.20.0100.05716.33
5.4.10.0100.04716.38
5.4.00.0070.05315.73
5.3.290.0070.07714.68
5.3.280.0100.07014.60
5.3.270.0070.07714.60
5.3.260.0030.04714.63
5.3.250.0030.07014.53
5.3.240.0070.07014.52
5.3.230.0070.09014.47
5.3.220.0100.07314.57
5.3.210.0070.08014.41
5.3.200.0170.06714.58
5.3.190.0070.08014.58
5.3.180.0070.08014.43
5.3.170.0030.08014.57
5.3.160.0030.07014.58
5.3.150.0100.06014.52
5.3.140.0100.04714.52
5.3.130.0030.08714.42
5.3.120.0070.07714.52
5.3.110.0030.07314.38
5.3.100.0000.08014.06
5.3.90.0030.07014.01
5.3.80.0030.05313.94
5.3.70.0070.07313.80
5.3.60.0030.06013.99
5.3.50.0170.03313.82
5.3.40.0030.05713.92
5.3.30.0070.06013.91
5.3.20.0030.08013.57
5.3.10.0070.07313.53
5.3.00.0030.07713.51
5.2.170.0070.06311.00
5.2.160.0000.06311.07
5.2.150.0000.05011.14
5.2.140.0100.05310.99
5.2.130.0100.05711.14
5.2.120.0100.05711.04
5.2.110.0000.06011.11
5.2.100.0100.05011.06
5.2.90.0130.05711.17
5.2.80.0000.04011.07
5.2.70.0030.06710.90
5.2.60.0030.04710.93
5.2.50.0000.05711.07
5.2.40.0000.05311.01
5.2.30.0000.06710.99
5.2.20.0030.04311.03
5.2.10.0030.04710.73
5.2.00.0030.06010.79
5.1.60.0030.0339.84
5.1.50.0070.05310.09
5.1.40.0000.04310.02
5.1.30.0070.05310.39
5.1.20.0030.05310.37
5.1.10.0030.05310.09
5.1.00.0030.05710.13
5.0.50.0030.0278.64
5.0.40.0070.0408.42
5.0.30.0030.0478.23
5.0.20.0000.0238.21
5.0.10.0030.0208.27
5.0.00.0000.0678.02
4.4.90.0030.0337.03
4.4.80.0000.0237.03
4.4.70.0000.0337.03
4.4.60.0000.0377.03
4.4.50.0030.0337.03
4.4.40.0070.0477.03
4.4.30.0030.0377.03
4.4.20.0000.0377.03
4.4.10.0000.0377.03
4.4.00.0030.0537.03
4.3.110.0070.0307.03
4.3.100.0000.0177.03
4.3.90.0070.0307.03
4.3.80.0000.0337.03
4.3.70.0070.0137.03
4.3.60.0000.0177.03
4.3.50.0000.0207.03
4.3.40.0000.0537.03
4.3.30.0000.0337.03
4.3.20.0030.0377.03
4.3.10.0030.0277.03
4.3.00.0000.0277.03

preferences:
54.05 ms | 401 KiB | 5 Q