3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add_one_month($date) { // find the next month $nextmonth = mktime(0, 0, 0, date("n", $date) + 1, 1, date("Y", $date)); // limit the day number according to the month $day = min(date("t", $nextmonth), date("j", $date)); // combine into desired date return mktime(0, 0, 0, date("n", $nextmonth), $day, date("Y", $nextmonth)); } for ($d = 20; $d <= 31; $d++) { $date = mktime(0, 0, 0, 1, $d, 2017); $normal = date("Y-m-d", strtotime("+1 month", $date)); $addonemonth = date("Y-m-d", add_one_month($date)); printf("2017-01-%02d: +1 month = %s add_one_month = %s\n", $d, $normal, $addonemonth); }

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.4.120.0100.00824.18
8.4.110.0110.00922.43
8.4.100.0140.00718.14
8.4.90.0120.01018.54
8.4.80.0130.00819.55
8.4.70.0140.00718.30
8.4.60.0040.00518.95
8.4.50.0070.01320.53
8.4.40.0140.00719.51
8.4.30.0070.01317.97
8.4.20.0070.01317.71
8.4.10.0100.00317.70
8.3.250.0080.00819.06
8.3.240.0120.00817.34
8.3.230.0130.00716.66
8.3.220.0090.00918.98
8.3.210.0100.00916.64
8.3.200.0040.01216.74
8.3.190.0120.00817.15
8.3.180.0090.00616.57
8.3.170.0180.00018.60
8.3.160.0110.00718.86
8.3.150.0120.00617.36
8.3.140.0160.00416.60
8.3.130.0080.00018.47
8.3.120.0130.00718.66
8.3.110.0050.00320.94
8.3.100.0080.00016.52
8.3.90.0150.00026.77
8.3.80.0030.00616.50
8.3.70.0080.00816.58
8.3.60.0040.01418.54
8.3.50.0080.01121.27
8.3.40.0070.01118.66
8.3.30.0040.01118.86
8.3.20.0030.00519.34
8.3.10.0000.00821.94
8.3.00.0050.00319.68
8.2.290.0130.00820.41
8.2.280.0060.00418.32
8.2.270.0170.00317.45
8.2.260.0080.00020.60
8.2.250.0050.00316.98
8.2.240.0140.00417.30
8.2.230.0070.01322.58
8.2.220.0060.00324.06
8.2.210.0060.00326.77
8.2.200.0030.00617.13
8.2.190.0120.00316.88
8.2.180.0180.00016.88
8.2.170.0160.01022.96
8.2.160.0100.00319.34
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0090.00020.65
8.2.120.0060.00326.35
8.2.110.0040.00822.39
8.2.100.0040.00818.03
8.2.90.0040.00418.34
8.2.80.0030.00618.04
8.2.70.0040.00418.03
8.2.60.0050.00317.93
8.2.50.0040.00418.10
8.2.40.0000.00820.41
8.2.30.0060.00319.26
8.2.20.0060.00318.14
8.2.10.0050.00318.19
8.2.00.0070.00018.44
8.1.330.0050.00421.83
8.1.320.0110.01116.10
8.1.310.0140.00416.79
8.1.300.0090.00016.44
8.1.290.0000.01130.84
8.1.280.0110.00425.92
8.1.270.0060.00322.18
8.1.260.0020.00526.35
8.1.250.0000.00828.09
8.1.240.0030.00622.26
8.1.230.0090.00319.22
8.1.220.0030.00517.79
8.1.210.0060.00318.77
8.1.200.0000.01017.46
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0040.00418.71
8.1.160.0040.00418.89
8.1.150.0050.00220.17
8.1.140.0040.00419.59
8.1.130.0040.00419.01
8.1.120.0070.00017.57
8.1.110.0030.00517.70
8.1.100.0040.00417.63
8.1.90.0030.00617.68
8.1.80.0030.00517.69
8.1.70.0000.00717.56
8.1.60.0040.00417.68
8.1.50.0050.00317.56
8.1.40.0040.00417.62
8.1.30.0080.00017.82
8.1.20.0000.00817.87
8.1.10.0060.00317.53
8.1.00.0080.00017.51
8.0.300.0040.00419.89
8.0.290.0000.00717.00
8.0.280.0000.00718.44
8.0.270.0000.00717.34
8.0.260.0000.00619.14
8.0.250.0070.00017.21
8.0.240.0040.00417.20
8.0.230.0030.00317.20
8.0.220.0000.00717.17
8.0.210.0000.00717.09
8.0.200.0030.00317.09
8.0.190.0070.00317.23
8.0.180.0040.00417.15
8.0.170.0000.00817.19
8.0.160.0040.00417.16
8.0.150.0000.00917.13
8.0.140.0050.00317.14
8.0.130.0070.00013.57
8.0.120.0050.00217.14
8.0.110.0040.00416.95
8.0.100.0000.00717.11
8.0.90.0030.00617.06
8.0.80.0000.01517.15
8.0.70.0040.00417.07
8.0.60.0040.00416.98
8.0.50.0080.00017.13
8.0.30.0110.00517.33
8.0.20.0080.01317.44
8.0.10.0000.00817.23
8.0.00.0060.01216.97
7.4.330.0000.00515.55
7.4.320.0030.00516.78
7.4.300.0000.00816.80
7.4.290.0070.00016.72
7.4.280.0020.00516.66
7.4.270.0000.00716.81
7.4.260.0030.00316.71
7.4.250.0000.00816.67
7.4.240.0000.00716.68
7.4.230.0070.00016.83
7.4.220.0160.00316.83
7.4.210.0080.00916.75
7.4.200.0050.00316.70
7.4.160.0060.00916.60
7.4.150.0140.00517.40
7.4.140.0130.00817.86
7.4.130.0120.00616.78
7.4.120.0130.00916.60
7.4.110.0120.00816.65
7.4.100.0160.00616.55
7.4.90.0070.01316.61
7.4.80.0130.00519.39
7.4.70.0140.00416.70
7.4.60.0090.00816.74
7.4.50.0030.00916.37
7.4.40.0060.01016.66
7.4.30.0090.01216.63
7.4.10.0090.00916.45
7.4.00.0030.01115.87
7.3.330.0000.00513.54
7.3.320.0030.00313.44
7.3.310.0030.00316.37
7.3.300.0070.00016.47
7.3.290.0000.00716.43
7.3.280.0090.01016.51
7.3.270.0070.01117.40
7.3.260.0070.01116.65
7.3.240.0060.01316.59
7.3.230.0140.00616.71
7.3.210.0090.00916.59
7.3.200.0030.01716.86
7.3.190.0090.00916.82
7.3.180.0120.00616.60
7.3.170.0090.00916.74
7.3.160.0070.01016.62
7.3.130.0100.00716.68
7.3.120.0110.00716.74
7.3.110.0030.01316.73
7.3.100.0100.00616.56
7.3.90.0100.00716.71
7.3.80.0040.01216.70
7.3.70.0130.00316.57
7.3.60.0070.01016.44
7.3.50.0060.01016.59
7.3.40.0100.00716.64
7.3.30.0060.00616.68
7.3.20.0030.01018.28
7.3.10.0070.01018.51
7.3.00.0000.01118.42
7.2.330.0100.01616.91
7.2.320.0150.00316.98
7.2.310.0100.00616.84
7.2.300.0080.00816.82
7.2.290.0140.01017.10
7.2.260.0140.00716.76
7.2.250.0120.00616.89
7.2.240.0060.00616.98
7.2.230.0100.00616.88
7.2.220.0090.00316.93
7.2.210.0040.01217.00
7.2.200.0070.01016.80
7.2.190.0070.01116.81
7.2.180.0070.01016.79
7.2.170.0030.01716.70
7.2.160.0070.01116.92
7.2.150.0040.01218.68
7.2.140.0000.01918.62
7.2.130.0000.01518.45
7.2.120.0100.00718.58
7.2.110.0080.00618.66
7.2.100.0090.00618.72
7.2.90.0040.01518.59
7.2.80.0000.01218.49
7.2.70.0040.01118.55
7.2.60.0070.01017.79
7.2.50.0070.01018.69
7.2.40.0030.00918.64
7.2.30.0030.01318.84
7.2.20.0090.00618.68
7.2.10.0100.00618.53
7.2.00.0030.01018.43
7.1.330.0030.01317.77
7.1.320.0100.00317.39
7.1.310.0070.00717.51
7.1.300.0030.01017.63
7.1.290.0060.00917.70
7.1.280.0100.00717.64
7.1.270.0000.01217.51
7.1.260.0030.01217.59
7.1.250.0060.00317.61
7.1.240.0060.00617.51
7.1.230.0110.00717.61
7.1.220.0090.00917.47
7.1.210.0030.01017.71
7.1.200.0100.00516.75
7.1.190.0030.01417.53
7.1.180.0070.01017.43
7.1.170.0090.00617.43
7.1.160.0000.00917.36
7.1.150.0090.00617.57
7.1.140.0050.00917.63
7.1.130.0040.01117.55
7.1.120.0080.00817.48
7.1.110.0040.01117.48
7.1.100.0030.01217.66
7.1.90.0070.00717.48
7.1.80.0030.01017.71
7.1.70.0060.00517.42
7.1.60.0050.00817.40
7.1.50.0130.01026.24
7.1.40.0120.01026.11
7.1.30.0100.01226.17
7.1.20.0120.01226.03
7.1.10.0050.01017.19
7.1.00.0050.00817.38
7.0.330.0030.00616.93
7.0.320.0070.01017.36
7.0.310.0110.00317.24
7.0.300.0030.01316.87
7.0.290.0070.01017.23
7.0.280.0000.01517.41
7.0.270.0030.00617.30
7.0.260.0150.00017.18
7.0.250.0030.00917.36
7.0.240.0120.00317.41
7.0.230.0060.01017.26
7.0.220.0070.00717.15
7.0.210.0030.00917.18
7.0.200.0060.01017.15
7.0.190.0020.01217.05
7.0.180.0050.01016.59
7.0.170.0070.00816.69
7.0.160.0080.01016.73
7.0.150.0070.00516.77
7.0.140.0020.01216.69
7.0.130.0040.01216.79
7.0.120.0040.01116.92
7.0.110.0050.01116.61
7.0.100.0020.01316.74
7.0.90.0090.00716.63
7.0.80.0030.01016.70
7.0.70.0070.00716.80
7.0.60.0050.01016.75
7.0.50.0030.01216.78
7.0.40.0060.00515.88
7.0.30.0030.00815.88
7.0.20.0050.00815.75
7.0.10.0060.00615.87
7.0.00.0070.00815.86
5.6.400.0100.00016.07
5.6.390.0070.00716.25
5.6.380.0090.00915.70
5.6.370.0030.01016.22
5.6.360.0030.01415.80
5.6.350.0000.01515.88
5.6.340.0060.00916.07
5.6.330.0100.00316.04
5.6.320.0000.01416.14
5.6.310.0060.00615.68
5.6.300.0090.00016.02
5.6.290.0030.01316.01
5.6.280.0040.01515.83
5.6.270.0120.00615.98
5.6.260.0090.00916.02
5.6.250.0040.00815.90
5.6.240.0060.01116.02
5.6.230.0090.00616.05
5.6.220.0060.01215.91
5.6.210.0000.01616.09
5.6.200.0100.00716.00
5.6.190.0130.00315.98
5.6.180.0030.01316.15
5.6.170.0000.01015.98
5.6.160.0060.01215.78
5.6.150.0090.01016.06
5.6.140.0100.00716.11
5.6.130.0070.01015.89
5.6.120.0060.00915.95
5.6.110.0110.00316.02
5.6.100.0070.00715.82
5.6.90.0110.00415.67
5.6.80.0070.01016.06
5.6.70.0070.00715.88
5.6.60.0040.01115.75
5.6.50.0030.01215.81
5.6.40.0070.01015.98
5.6.30.0130.00615.69
5.6.20.0100.01015.89
5.6.10.0040.01115.75
5.6.00.0040.01115.77

preferences:
28.51 ms | 403 KiB | 5 Q