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) { $nextMonth = date("Y-m", strtotime($firstOfThis . " +" . $monthInc . " month")); $output = $nextMonth . '-' . $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.0100.01018.55
8.3.60.0060.01218.31
8.3.50.0120.00817.50
8.3.40.0140.00718.96
8.3.30.0150.00718.79
8.3.20.0040.00419.02
8.3.10.0030.00620.53
8.3.00.0090.00017.88
8.2.180.0110.00418.25
8.2.170.0120.00322.96
8.2.160.0150.00622.14
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0090.00019.95
8.2.110.0030.00721.08
8.2.100.0120.00017.97
8.2.90.0000.01019.17
8.2.80.0030.00518.05
8.2.70.0030.00517.74
8.2.60.0000.00918.03
8.2.50.0080.00018.07
8.2.40.0000.00818.34
8.2.30.0080.00018.15
8.2.20.0000.00818.05
8.2.10.0060.00318.03
8.2.00.0070.00017.91
8.1.280.0090.00625.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.01022.59
8.1.230.0040.00721.02
8.1.220.0060.00317.74
8.1.210.0060.00318.98
8.1.200.0060.00317.63
8.1.190.0030.00517.77
8.1.180.0000.00818.10
8.1.170.0000.00918.96
8.1.160.0000.00719.05
8.1.150.0040.00418.91
8.1.140.0030.00617.64
8.1.130.0000.00718.03
8.1.120.0000.00717.64
8.1.110.0050.00317.71
8.1.100.0000.00817.76
8.1.90.0040.00417.63
8.1.80.0000.00817.62
8.1.70.0030.00317.64
8.1.60.0000.00917.79
8.1.50.0040.00417.74
8.1.40.0040.00417.69
8.1.30.0000.00717.80
8.1.20.0040.00717.76
8.1.10.0040.00417.77
8.1.00.0040.00417.72
8.0.300.0050.00220.00
8.0.290.0080.00017.00
8.0.280.0050.00218.61
8.0.270.0030.00517.42
8.0.260.0070.00017.21
8.0.250.0040.00417.31
8.0.240.0000.00817.34
8.0.230.0000.00817.29
8.0.220.0000.00717.14
8.0.210.0000.00717.25
8.0.200.0000.01017.31
8.0.190.0000.01117.15
8.0.180.0030.00517.29
8.0.170.0060.00317.11
8.0.160.0000.00717.28
8.0.150.0090.00017.21
8.0.140.0080.00017.10
8.0.130.0000.00513.60
8.0.120.0000.00717.29
8.0.110.0040.00417.07
8.0.100.0040.00417.30
8.0.90.0000.00717.08
8.0.80.0070.01417.23
8.0.70.0070.00017.24
8.0.60.0080.00017.19
8.0.50.0040.00417.23
8.0.30.0120.01217.23
8.0.20.0080.01117.32
8.0.10.0000.00717.32
8.0.00.0070.01216.90
7.4.330.0050.00014.85
7.4.320.0000.00616.77
7.4.300.0000.00616.64
7.4.290.0000.00716.71
7.4.280.0000.01116.70
7.4.270.0040.00416.73
7.4.260.0040.00413.31
7.4.250.0030.00616.62
7.4.240.0040.00416.81
7.4.230.0040.00416.71
7.4.220.0050.01016.84
7.4.210.0060.01016.77
7.4.200.0040.00416.89
7.4.190.0050.00216.63
7.4.160.0140.00316.83
7.4.150.0060.01617.07
7.4.140.0070.01017.36
7.4.130.0060.01716.87
7.4.120.0100.01016.69
7.4.110.0070.01616.80
7.4.100.0110.00716.75
7.4.90.0030.01616.74
7.4.80.0070.01018.80
7.4.70.0060.01216.64
7.4.60.0110.00716.82
7.4.50.0000.00816.56
7.4.40.0000.01221.94
7.4.30.0100.00716.55
7.4.00.0100.00615.21
7.3.330.0030.00313.36
7.3.320.0030.00313.53
7.3.310.0000.00816.53
7.3.300.0000.00716.63
7.3.290.0060.00916.59
7.3.280.0090.00616.52
7.3.270.0150.00317.07
7.3.260.0080.01218.24
7.3.250.0120.01016.67
7.3.240.0150.00616.69
7.3.230.0140.00316.78
7.3.210.0130.00416.80
7.3.200.0130.00319.39
7.3.190.0070.01116.67
7.3.180.0130.00316.57
7.3.170.0150.00616.69
7.3.160.0090.00616.77
7.3.120.0030.01415.18
7.3.110.0070.01015.19
7.3.100.0030.01415.19
7.3.90.0030.01015.22
7.3.80.0120.00614.97
7.3.70.0090.00914.89
7.3.60.0070.01314.85
7.3.50.0110.00315.14
7.3.40.0110.00314.74
7.3.30.0060.01215.12
7.3.20.0060.00617.06
7.3.10.0100.00716.84
7.3.00.0070.00816.85
7.2.330.0110.00716.95
7.2.320.0080.00817.04
7.2.310.0200.02017.03
7.2.300.0090.01216.85
7.2.290.0110.00617.03
7.2.250.0060.01215.34
7.2.240.0060.01015.17
7.2.230.0070.00615.47
7.2.220.0110.00015.02
7.2.210.0130.00315.29
7.2.200.0110.00715.23
7.2.190.0090.00915.07
7.2.180.0090.00615.46
7.2.170.0140.00015.20
7.2.130.0090.01117.16
7.2.120.0060.01016.88
7.2.110.0140.00616.75
7.2.100.0140.00816.94
7.2.90.0140.00617.13
7.2.80.0120.00916.88
7.2.70.0130.00817.07
7.2.60.0190.00316.91
7.2.50.0100.00917.03
7.2.40.0180.00917.03
7.2.30.0130.00317.14
7.2.20.0090.00717.03
7.2.10.0080.00916.83
7.2.00.0070.00917.85
7.1.330.0100.00316.19
7.1.320.0040.00816.03
7.1.310.0060.00316.05
7.1.300.0030.00815.95
7.1.290.0100.00315.94
7.1.280.0100.00616.06
7.1.270.0090.00615.95
7.1.260.0100.00716.14
7.1.250.0100.00815.63
7.1.240.0110.00815.94
7.1.230.0140.00415.79
7.1.220.0070.01015.82
7.1.210.0110.00615.71
7.1.200.0050.01015.80
7.1.190.0190.00015.65
7.1.180.0120.00415.90
7.1.170.0130.00315.75
7.1.160.0100.01015.87
7.1.150.0100.00715.88
7.1.140.0060.00615.72
7.1.130.0060.00915.90
7.1.120.0120.00815.61
7.1.110.0090.00316.08
7.1.100.0070.01017.22
7.1.90.0120.00415.87
7.1.80.0120.00615.83
7.1.70.0080.00416.65
7.1.60.0150.00617.60
7.1.50.0100.00716.52
7.1.40.0090.01015.90
7.1.30.0000.01815.90
7.1.20.0120.00815.56
7.1.10.0050.01015.87
7.1.00.0050.04219.07
7.0.330.0100.00715.32
7.0.320.0110.00515.07
7.0.310.0070.00715.19
7.0.300.0120.00615.34
7.0.290.0140.00315.37
7.0.280.0200.00015.49
7.0.270.0120.00415.36
7.0.260.0100.00015.41
7.0.250.0100.00615.58
7.0.240.0050.00915.55
7.0.230.0050.01015.36
7.0.220.0120.00415.40
7.0.210.0090.00915.44
7.0.200.0050.00816.06
7.0.190.0150.00315.46
7.0.180.0140.00015.17
7.0.170.0070.01115.45
7.0.160.0030.01315.38
7.0.150.0090.00615.45
7.0.140.0090.03818.72
7.0.130.0060.01015.51
7.0.120.0040.02018.83
7.0.110.0090.01215.43
7.0.100.0120.00415.57
7.0.90.0080.02718.54
7.0.80.0080.03618.64
7.0.70.0070.02518.68
7.0.60.0070.04218.71
7.0.50.0080.03818.78
7.0.40.0090.03816.82
7.0.30.0030.04516.80
7.0.20.0020.03216.69
7.0.10.0070.03316.88
7.0.00.0070.02316.73
5.6.380.0070.00714.45
5.6.370.0060.01314.24
5.6.360.0060.00914.45
5.6.350.0040.01114.06
5.6.340.0040.01114.44
5.6.330.0000.01114.53
5.6.320.0070.00714.68
5.6.310.0130.00614.42
5.6.300.0090.00613.96
5.6.290.0030.01014.36
5.6.280.0100.00313.99
5.6.270.0060.00614.41
5.6.260.0100.00314.19
5.6.250.0030.01314.05
5.6.240.0050.04717.57
5.6.230.0060.04617.55
5.6.220.0050.02517.63
5.6.210.0030.04117.52
5.6.200.0080.04017.67
5.6.190.0020.03317.60
5.6.180.0020.04717.60
5.6.170.0050.04317.63
5.6.160.0080.03217.64
5.6.150.0020.04717.78
5.6.140.0030.04517.78
5.6.130.0030.04417.76
5.6.120.0020.02817.74
5.6.110.0040.05017.60
5.6.100.0050.03917.67
5.6.90.0070.05017.54
5.6.80.0040.02217.43
5.6.70.0090.03917.31
5.6.60.0080.03117.21
5.6.50.0060.02717.34
5.6.40.0030.04417.25
5.6.30.0050.02517.33
5.6.20.0060.03617.28
5.6.10.0070.01817.34
5.6.00.0060.02017.48
5.5.380.0070.03715.86
5.5.370.0080.02515.76
5.5.360.0040.03415.75
5.5.350.0090.02015.70
5.5.340.0040.02516.02
5.5.330.0070.04016.05
5.5.320.0030.04415.99
5.5.310.0100.03816.04
5.5.300.0010.04415.98
5.5.290.0040.03916.06
5.5.280.0050.03215.88
5.5.270.0050.03015.99
5.5.260.0030.04815.91
5.5.250.0070.04015.89
5.5.240.0050.03915.70
5.5.230.0040.02815.64
5.5.220.0060.03315.60
5.5.210.0010.04615.73
5.5.200.0040.03315.76
5.5.190.0020.02015.73
5.5.180.0030.03815.59
5.5.170.0000.01010.94
5.5.160.0040.04215.79
5.5.150.0020.04515.78
5.5.140.0060.04115.81
5.5.130.0030.04315.58
5.5.120.0060.03915.81
5.5.110.0050.02415.77
5.5.100.0060.04115.64
5.5.90.0080.04115.72
5.5.80.0030.03815.50
5.5.70.0050.04015.67
5.5.60.0030.02115.50
5.5.50.0050.03515.68
5.5.40.0030.03815.63
5.5.30.0090.01515.60
5.5.20.0030.01815.50
5.5.10.0030.03115.50
5.5.00.0030.03915.43
5.4.450.0070.04215.43
5.4.440.0050.04015.32
5.4.430.0050.03515.36
5.4.420.0070.04015.17
5.4.410.0050.04015.15
5.4.400.0070.02515.08
5.4.390.0020.04214.97
5.4.380.0080.02615.03
5.4.370.0090.03814.96
5.4.360.0070.04115.13
5.4.350.0030.04115.14
5.4.340.0030.03215.02
5.4.330.0110.00011.11
5.4.320.0000.02915.01
5.4.310.0080.03815.13
5.4.300.0050.02215.24
5.4.290.0050.01815.37
5.4.280.0040.02415.13
5.4.270.0060.02915.06
5.4.260.0030.02015.13
5.4.250.0030.02115.12
5.4.240.0120.02815.15
5.4.230.0060.03514.93
5.4.220.0060.02115.16
5.4.210.0040.02015.13
5.4.200.0050.03415.26
5.4.190.0040.02415.06
5.4.180.0080.01615.18
5.4.170.0050.02214.99
5.4.160.0000.03114.96
5.4.150.0070.01815.23
5.4.140.0060.02013.59
5.4.130.0020.02213.66
5.4.120.0080.01613.63
5.4.110.0070.02813.62
5.4.100.0060.02013.62
5.4.90.0050.02113.61
5.4.80.0040.04013.78
5.4.70.0070.01513.74
5.4.60.0020.01813.67
5.4.50.0060.02813.71
5.4.40.0030.02813.84
5.4.30.0000.03913.75
5.4.20.0080.03613.73
5.4.10.0050.03613.81
5.4.00.0030.03213.42
5.3.290.0070.04512.76
5.3.280.0020.02812.79
5.3.270.0060.03212.81
5.3.260.0070.02812.74
5.3.250.0020.04212.76
5.3.240.0060.02312.71
5.3.230.0030.03512.76
5.3.220.0040.03412.72
5.3.210.0020.03512.76
5.3.200.0030.02512.72
5.3.190.0030.02412.70
5.3.180.0030.03312.73
5.3.170.0100.03712.76
5.3.160.0030.03312.71
5.3.150.0040.01712.71
5.3.140.0020.04212.76
5.3.130.0030.01712.71
5.3.120.0060.04012.75
5.3.110.0000.02212.73
5.3.100.0000.03912.49
5.3.90.0030.04012.51
5.3.80.0050.03712.47
5.3.70.0020.03912.40
5.3.60.0030.02712.42
5.3.50.0030.01812.42
5.3.40.0080.03412.37
5.3.30.0050.02512.45
5.3.20.0030.04212.24
5.3.10.0000.02012.31
5.3.00.0030.03112.23
5.2.170.0030.01510.99
5.2.160.0040.03111.07
5.2.150.0020.03210.95
5.2.140.0010.03510.97
5.2.130.0040.02811.07
5.2.120.0030.03211.03
5.2.110.0040.01310.93
5.2.100.0020.02211.06
5.2.90.0000.03110.95
5.2.80.0050.01611.07
5.2.70.0020.01611.04
5.2.60.0020.01511.04
5.2.50.0030.01510.97
5.2.40.0020.02710.95
5.2.30.0000.03710.98
5.2.20.0040.02810.96
5.2.10.0020.01710.91
5.2.00.0040.03210.77
5.1.60.0080.01810.51
5.1.50.0020.03110.48
5.1.40.0030.01310.49
5.1.30.0020.02910.55
5.1.20.0010.03110.65
5.1.10.0030.02310.48
5.1.00.0050.02610.48
5.0.50.0060.0129.99
5.0.40.0040.0179.99
5.0.30.0030.0359.99
5.0.20.0020.0139.99
5.0.10.0010.0159.99
5.0.00.0040.0339.99
4.4.90.0000.0109.99
4.4.80.0000.0099.99
4.4.70.0020.0159.99
4.4.60.0000.0109.99
4.4.50.0000.0139.99
4.4.40.0020.0179.99
4.4.30.0000.0119.99
4.4.20.0050.0199.99
4.4.10.0020.0279.99
4.4.00.0020.0289.99
4.3.110.0040.0179.99
4.3.100.0000.0189.99
4.3.90.0000.0199.99
4.3.80.0030.0289.99
4.3.70.0040.0139.99
4.3.60.0020.0209.99
4.3.50.0070.0139.99
4.3.40.0000.0159.99
4.3.30.0020.0229.99
4.3.20.0000.0209.99
4.3.10.0030.0209.99
4.3.00.0010.0209.99

preferences:
45.84 ms | 401 KiB | 5 Q