3v4l.org

run code in 300+ PHP versions simultaneously
<?php function nextMonth($thisMonth, $monthInc) { $firstOfThis = date("Y-m", strtotime($thisMonth)); $dNow = date("t", strtotime($thisMonth)); $dNext = date("t", strtotime($firstOfThis . " +" . $monthInc . " month")); $dDay = date("d", strtotime($thisMonth)); $output = date("Y-m-d",strtotime($thisMonth . " +" . $monthInc . " month")); if ($dNext < $dNow && $dNext < $dDay) { $output = date("Y-m", strtotime($firstOfThis . " +" . $monthInc . " month")) . '-' . $dNext; } return $output . "\n"; } echo nextMonth("2009-12-31",2); echo nextMonth("2010-01-31",1); echo nextMonth("2010-01-05",1); echo nextMonth("2010-12-05",1); exit(); ?>

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.70.0180.00418.53
8.3.60.0100.01016.75
8.3.50.0070.01222.13
8.3.40.0090.00619.06
8.3.30.0070.00719.21
8.3.20.0080.00020.16
8.3.10.0050.00323.52
8.3.00.0040.00420.68
8.2.180.0090.00617.00
8.2.170.0060.00922.96
8.2.160.0030.01322.02
8.2.150.0030.00524.18
8.2.140.0000.01524.66
8.2.130.0040.00426.16
8.2.120.0080.00022.20
8.2.110.0040.00422.20
8.2.100.0060.00618.03
8.2.90.0080.00019.39
8.2.80.0060.00318.05
8.2.70.0030.00617.88
8.2.60.0040.00418.05
8.2.50.0000.00918.07
8.2.40.0050.00717.97
8.2.30.0000.00718.28
8.2.20.0040.00417.91
8.2.10.0040.00417.95
8.2.00.0040.00418.02
8.1.280.0140.00025.92
8.1.270.0050.00323.95
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.92
8.1.230.0040.00719.16
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0060.00317.72
8.1.190.0030.00517.68
8.1.180.0030.00518.10
8.1.170.0000.00818.73
8.1.160.0040.00422.13
8.1.150.0040.00418.90
8.1.140.0030.00517.65
8.1.130.0050.00217.85
8.1.120.0050.00217.73
8.1.110.0060.00317.73
8.1.100.0040.00417.63
8.1.90.0070.00017.74
8.1.80.0000.00717.76
8.1.70.0000.00717.70
8.1.60.0060.00317.79
8.1.50.0040.00417.71
8.1.40.0000.00717.73
8.1.30.0030.00517.83
8.1.20.0030.00517.81
8.1.10.0030.00617.59
8.1.00.0040.00417.73
8.0.300.0070.00018.77
8.0.290.0040.00417.29
8.0.280.0070.00018.61
8.0.270.0000.00817.32
8.0.260.0030.00317.18
8.0.250.0080.00017.34
8.0.240.0000.00717.28
8.0.230.0030.00317.27
8.0.220.0030.00517.24
8.0.210.0040.00417.26
8.0.200.0060.00017.36
8.0.190.0040.00417.23
8.0.180.0040.00417.34
8.0.170.0000.00817.16
8.0.160.0020.00517.22
8.0.150.0040.00417.22
8.0.140.0040.00417.09
8.0.130.0030.00313.66
8.0.120.0000.00817.28
8.0.110.0000.00817.26
8.0.100.0000.00817.20
8.0.90.0040.00417.05
8.0.80.0060.01317.31
8.0.70.0000.00717.36
8.0.60.0040.00417.29
8.0.50.0000.00717.13
8.0.30.0100.00917.32
8.0.20.0120.00617.40
8.0.10.0040.00417.47
8.0.00.0150.01016.98
7.4.330.0020.00215.21
7.4.320.0030.00316.77
7.4.300.0060.00016.84
7.4.290.0000.01116.81
7.4.280.0080.00016.61
7.4.270.0030.00316.83
7.4.260.0030.00316.77
7.4.250.0070.00016.74
7.4.240.0000.00716.78
7.4.230.0040.00416.84
7.4.220.0070.01116.72
7.4.210.0080.00916.85
7.4.200.0030.00316.58
7.4.190.0070.00016.97
7.4.160.0060.00916.81
7.4.150.0100.00717.40
7.4.140.0090.00817.86
7.4.130.0130.00616.79
7.4.120.0170.00216.79
7.4.110.0060.01116.78
7.4.100.0120.00816.75
7.4.90.0090.00916.75
7.4.80.0140.00716.72
7.4.70.0130.00316.74
7.4.60.0090.00616.56
7.4.50.0000.00916.57
7.4.40.0030.01022.77
7.4.30.0120.00716.57
7.4.00.0070.00715.12
7.3.330.0000.00513.35
7.3.320.0030.00313.37
7.3.310.0000.00716.57
7.3.300.0000.00816.54
7.3.290.0070.00716.50
7.3.280.0090.00916.53
7.3.270.0120.00717.40
7.3.260.0040.01416.88
7.3.250.0110.00516.79
7.3.240.0100.00916.76
7.3.230.0060.01216.61
7.3.210.0100.01316.80
7.3.200.0170.00319.39
7.3.190.0130.00616.88
7.3.180.0100.01016.85
7.3.170.0070.01016.76
7.3.160.0060.00916.57
7.3.120.0000.01315.21
7.2.330.0100.00717.05
7.2.320.0060.01216.75
7.2.310.0130.00317.06
7.2.300.0080.00916.98
7.2.290.0120.00417.02
7.2.00.0080.00319.50
7.1.100.0000.00818.05
7.1.70.0030.00717.59
7.1.60.0100.01319.29
7.1.50.0130.00317.32
7.1.00.0000.08022.40
7.0.200.0130.00317.05
7.0.140.0000.07021.95
7.0.80.0600.07719.91
7.0.70.0630.06319.87
7.0.60.0630.07319.98
7.0.50.0530.06720.36
7.0.40.0030.08320.08
7.0.30.0100.04320.11
7.0.20.0070.05019.95
7.0.10.0100.07020.16
7.0.00.0130.08020.10
5.6.280.0030.07321.04
5.6.230.0070.08720.66
5.6.220.0070.09020.68
5.6.210.0170.07720.55
5.6.200.0130.08021.00
5.6.190.0130.07321.06
5.6.180.0100.05320.94
5.6.170.0070.04321.11
5.6.160.0100.05021.17
5.6.150.0000.05320.94
5.6.140.0100.08021.12
5.6.130.0070.06721.02
5.6.120.0130.05720.89
5.6.110.0130.06721.04
5.6.100.0030.09020.95
5.6.90.0130.08021.09
5.6.80.0000.06020.32
5.6.70.0100.04320.45
5.6.60.0130.07020.43
5.6.50.0200.03020.49
5.6.40.0070.04720.31
5.6.30.0100.07320.37
5.6.20.0030.08320.49
5.6.10.0070.06320.30
5.6.00.0070.08020.43
5.5.370.0130.07720.36
5.5.360.0030.05020.56
5.5.350.0070.07020.41
5.5.340.0000.08720.92
5.5.330.0070.04020.80
5.5.320.0130.04320.89
5.5.310.0200.06320.88
5.5.300.0200.08320.78
5.5.290.0030.05020.73
5.5.280.0100.03720.78
5.5.270.0170.08020.78
5.5.260.0100.08320.87
5.5.250.0230.06320.45
5.5.240.0100.05020.20
5.5.230.0130.07720.25
5.5.220.0030.05320.24
5.5.210.0030.06020.02
5.5.200.0070.07320.00
5.5.190.0130.06020.25
5.5.180.0000.07020.16
5.5.160.0000.05320.19
5.5.150.0200.06720.26
5.5.140.0070.08020.23
5.5.130.0130.07320.22
5.5.120.0130.07020.13
5.5.110.0170.06720.23
5.5.100.0100.07720.14
5.5.90.0130.05020.06
5.5.80.0100.07720.17
5.5.70.0070.07720.10
5.5.60.0070.08020.15
5.5.50.0100.03720.10
5.5.40.0130.06720.02
5.5.30.0170.07320.13
5.5.20.0000.06019.98
5.5.10.0130.03319.99
5.5.00.0070.07719.97
5.4.450.0070.04019.38
5.4.440.0130.05019.27
5.4.430.0130.06719.37
5.4.420.0170.06719.44
5.4.410.0100.08319.25
5.4.400.0000.04319.14
5.4.390.0070.08318.89
5.4.380.0170.06319.18
5.4.370.0130.03719.05
5.4.360.0070.07319.16
5.4.350.0100.06719.04
5.4.340.0100.07319.16
5.4.320.0000.08319.03
5.4.310.0130.06319.14
5.4.300.0100.06719.18
5.4.290.0070.07318.84
5.4.280.0030.08318.90
5.4.270.0070.08319.11
5.4.260.0170.06318.90
5.4.250.0170.07018.89
5.4.240.0030.07319.17
5.4.230.0070.07318.84
5.4.220.0100.05319.23
5.4.210.0100.07018.89
5.4.200.0100.07319.23
5.4.190.0100.04718.94
5.4.180.0070.05719.13
5.4.170.0070.04019.08
5.4.160.0070.04719.14
5.4.150.0100.05318.82
5.4.140.0100.06716.41
5.4.130.0070.06016.41
5.4.120.0070.04716.46
5.4.110.0070.07016.44
5.4.100.0170.05016.39
5.4.90.0130.06316.47
5.4.80.0070.06316.34
5.4.70.0170.06316.41
5.4.60.0070.05316.25
5.4.50.0070.05316.24
5.4.40.0170.05716.35
5.4.30.0000.08016.44
5.4.20.0130.06716.32
5.4.10.0100.07016.32
5.4.00.0100.07315.84
5.3.290.0030.05014.79
5.3.280.0030.04314.62
5.3.270.0070.07314.59
5.3.260.0070.05314.71
5.3.250.0100.07014.58
5.3.240.0070.07714.55
5.3.230.0070.07714.53
5.3.220.0070.05314.57
5.3.210.0000.05714.53
5.3.200.0070.07714.61
5.3.190.0100.06314.67
5.3.180.0130.03714.55
5.3.170.0130.07014.51
5.3.160.0070.05014.63
5.3.150.0070.03714.68
5.3.140.0000.08314.62
5.3.130.0000.05014.57
5.3.120.0030.07714.52
5.3.110.0030.08014.50
5.3.100.0070.07714.04
5.3.90.0100.06713.98
5.3.80.0170.06313.93
5.3.70.0000.07014.08
5.3.60.0030.06714.01
5.3.50.0100.07314.02
5.3.40.0070.07013.88
5.3.30.0070.07313.81
5.3.20.0070.07313.67
5.3.10.0170.06013.63
5.3.00.0130.07013.64
5.2.170.0030.06711.25
5.2.160.0070.06311.03
5.2.150.0000.06311.05
5.2.140.0030.05711.16
5.2.130.0070.05711.09
5.2.120.0100.05311.15
5.2.110.0030.06011.10
5.2.100.0070.06011.10
5.2.90.0100.05711.17
5.2.80.0130.04011.23
5.2.70.0070.06311.14
5.2.60.0100.05311.11
5.2.50.0070.05311.05
5.2.40.0030.06311.00
5.2.30.0070.05010.88
5.2.20.0070.06011.05
5.2.10.0070.06310.91
5.2.00.0030.06310.73
5.1.60.0100.05010.08
5.1.50.0000.05310.10
5.1.40.0100.0509.97
5.1.30.0030.05310.37
5.1.20.0070.05710.36
5.1.10.0000.06310.16
5.1.00.0100.05010.14
5.0.50.0030.0478.64
5.0.40.0030.0438.48
5.0.30.0100.0578.32
5.0.20.0070.0278.32
5.0.10.0070.0408.18
5.0.00.0030.0608.21
4.4.90.0000.0337.39
4.4.80.0030.0337.39
4.4.70.0030.0337.39
4.4.60.0030.0377.39
4.4.50.0070.0337.39
4.4.40.0000.0537.39
4.4.30.0030.0337.39
4.4.20.0000.0407.39
4.4.10.0000.0377.39
4.4.00.0070.0407.39
4.3.110.0000.0307.39
4.3.100.0030.0277.39
4.3.90.0000.0377.39
4.3.80.0000.0477.39
4.3.70.0030.0337.39
4.3.60.0070.0337.39
4.3.50.0000.0337.39
4.3.40.0030.0477.39
4.3.30.0030.0337.39
4.3.20.0000.0337.39
4.3.10.0030.0237.39
4.3.00.0030.0307.39

preferences:
68.59 ms | 401 KiB | 5 Q