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")); if ($dnext < $dnow && $dnext < $dday) { $nextMonth = date("Y-m", strtotime($sample1)); $nextMonth = date("Y-m", strtotime($nextMonth . " +1 month")); $output = $nextMonth . '-' . $dnext; } echo $output; $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.00716.63
8.3.50.0100.00822.10
8.3.40.0110.00718.61
8.3.30.0070.00719.04
8.3.20.0080.00020.16
8.3.10.0040.00423.67
8.3.00.0070.00020.54
8.2.180.0120.00316.60
8.2.170.0120.00322.96
8.2.160.0030.01022.25
8.2.150.0080.00024.18
8.2.140.0060.01024.66
8.2.130.0000.00826.16
8.2.120.0040.00422.25
8.2.110.0030.00622.38
8.2.100.0080.00417.78
8.2.90.0040.00419.17
8.2.80.0000.00918.05
8.2.70.0030.00617.75
8.2.60.0040.00418.05
8.2.50.0060.00318.07
8.2.40.0060.00618.34
8.2.30.0030.00618.14
8.2.20.0000.00717.85
8.2.10.0050.00217.96
8.2.00.0040.00417.89
8.1.280.0070.01025.92
8.1.270.0040.00423.88
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00023.79
8.1.230.0040.00819.20
8.1.220.0000.00817.78
8.1.210.0040.00418.77
8.1.200.0000.00917.60
8.1.190.0050.00317.65
8.1.180.0000.00818.10
8.1.170.0000.00818.83
8.1.160.0000.00922.09
8.1.150.0080.00018.82
8.1.140.0000.00817.78
8.1.130.0050.00218.02
8.1.120.0050.00317.66
8.1.110.0050.00317.74
8.1.100.0070.00017.79
8.1.90.0040.00417.72
8.1.80.0000.00717.67
8.1.70.0030.00317.64
8.1.60.0100.00317.71
8.1.50.0090.00017.69
8.1.40.0040.00417.63
8.1.30.0030.00517.83
8.1.20.0050.00517.77
8.1.10.0000.00717.65
8.1.00.0050.00317.80
8.0.300.0040.00418.77
8.0.290.0080.00017.05
8.0.280.0080.00018.56
8.0.270.0070.00017.29
8.0.260.0000.00717.11
8.0.250.0000.00717.14
8.0.240.0040.00417.17
8.0.230.0020.00517.23
8.0.220.0070.00017.20
8.0.210.0000.00717.13
8.0.200.0000.00717.15
8.0.190.0070.00317.16
8.0.180.0080.00017.17
8.0.170.0040.00417.23
8.0.160.0000.00717.14
8.0.150.0000.00717.08
8.0.140.0030.00617.16
8.0.130.0000.00613.53
8.0.120.0040.00417.18
8.0.110.0060.00317.11
8.0.100.0040.00416.98
8.0.90.0040.00417.24
8.0.80.0100.01317.24
8.0.70.0040.00417.25
8.0.60.0070.00017.18
8.0.50.0000.00717.13
8.0.30.0050.01617.37
8.0.20.0110.00817.48
8.0.10.0000.00817.17
8.0.00.0070.01217.01
7.4.330.0050.00015.22
7.4.320.0000.00616.85
7.4.300.0070.00316.75
7.4.290.0070.00316.72
7.4.280.0000.00716.80
7.4.270.0030.00316.82
7.4.260.0070.00016.63
7.4.250.0050.00316.68
7.4.240.0030.00316.82
7.4.230.0040.00416.92
7.4.220.0110.00616.91
7.4.210.0060.01016.81
7.4.200.0070.00016.76
7.4.190.0040.00416.61
7.4.160.0060.00916.87
7.4.150.0060.01317.40
7.4.140.0150.00417.86
7.4.130.0100.00816.74
7.4.120.0070.01416.88
7.4.110.0090.00916.90
7.4.100.0110.01016.78
7.4.90.0130.00816.64
7.4.80.0070.01016.80
7.4.70.0070.01116.68
7.4.60.0060.01016.76
7.4.50.0020.00216.76
7.4.40.0070.01022.77
7.4.30.0110.00716.79
7.4.10.0150.00415.10
7.4.00.0050.01315.16
7.3.330.0000.00613.35
7.3.320.0040.00413.37
7.3.310.0000.00716.46
7.3.300.0000.00716.22
7.3.290.0090.00616.36
7.3.280.0110.00616.37
7.3.270.0100.00717.40
7.3.260.0060.01516.57
7.3.250.0070.01316.72
7.3.240.0060.01116.63
7.3.230.0130.00616.65
7.3.210.0110.00616.64
7.3.200.0130.01019.39
7.3.190.0190.00416.54
7.3.180.0060.01216.55
7.3.170.0080.00816.59
7.3.160.0080.00816.54
7.3.130.0030.01314.93
7.3.120.0070.00915.21
7.3.110.0070.01014.93
7.3.100.0030.01414.93
7.3.90.0070.00915.05
7.3.80.0070.00914.96
7.3.70.0030.01015.01
7.3.60.0070.00814.77
7.3.50.0050.01114.97
7.3.40.0040.00714.97
7.3.30.0070.00614.93
7.3.20.0040.00616.82
7.3.10.0060.00716.79
7.3.00.0070.00516.74
7.2.330.0070.01316.55
7.2.320.0130.00716.96
7.2.310.0120.00616.89
7.2.300.0160.00517.02
7.2.290.0160.00016.68
7.2.260.0060.01315.28
7.2.250.0090.00915.45
7.2.240.0030.01215.18
7.2.230.0060.01015.38
7.2.220.0060.00815.31
7.2.210.0050.01315.34
7.2.200.0020.01215.28
7.2.190.0070.00915.33
7.2.180.0060.01115.25
7.2.170.0050.00815.33
7.2.160.0030.01215.24
7.2.150.0040.01217.16
7.2.140.0060.00917.05
7.2.130.0040.01016.97
7.2.120.0040.01117.18
7.2.110.0060.00917.09
7.2.100.0080.00817.11
7.2.90.0100.00617.10
7.2.80.0070.00417.09
7.2.70.0070.00817.01
7.2.60.0040.01017.06
7.2.50.0030.00817.16
7.2.40.0070.00717.21
7.2.30.0100.00717.08
7.2.20.0080.00817.09
7.2.10.0070.00917.02
7.2.00.0070.00517.78
7.1.330.0080.00716.09
7.1.320.0060.00816.02
7.1.310.0070.00916.01
7.1.300.0040.01215.90
7.1.290.0070.00716.08
7.1.280.0080.00316.02
7.1.270.0060.00816.02
7.1.260.0060.00716.06
7.1.250.0030.01015.92
7.1.240.0050.01016.00
7.1.230.0070.00515.75
7.1.220.0060.00515.98
7.1.210.0070.00816.05
7.1.200.0040.00715.94
7.1.190.0030.00715.99
7.1.180.0050.00616.01
7.1.170.0110.00216.01
7.1.160.0000.01415.88
7.1.150.0050.00616.02
7.1.140.0050.00815.93
7.1.130.0080.00315.88
7.1.120.0090.00315.94
7.1.110.0030.00815.99
7.1.100.0070.00716.78
7.1.90.0020.01015.92
7.1.80.0020.01015.81
7.1.70.0020.00916.34
7.1.60.0050.01217.07
7.1.50.0030.01116.38
7.1.40.0060.00815.94
7.1.30.0020.01216.00
7.1.20.0020.01115.97
7.1.10.0030.00816.07
7.1.00.0030.03118.09
7.0.330.0070.00315.49
7.0.320.0020.00815.50
7.0.310.0030.01015.64
7.0.300.0040.01115.43
7.0.290.0060.00515.45
7.0.280.0050.00515.50
7.0.270.0030.01115.66
7.0.260.0050.00515.63
7.0.250.0070.00415.53
7.0.240.0080.00515.59
7.0.230.0070.00715.45
7.0.220.0060.00615.80
7.0.210.0100.00315.60
7.0.200.0050.00616.01
7.0.190.0030.00815.47
7.0.180.0070.00615.51
7.0.170.0050.00915.60
7.0.160.0060.00615.66
7.0.150.0050.00515.48
7.0.140.0040.03117.82
7.0.130.0090.00515.66
7.0.120.0090.00515.62
7.0.110.0070.00415.69
7.0.100.0030.01015.62
7.0.90.0060.03617.79
7.0.80.0060.03117.58
7.0.70.0050.03117.53
7.0.60.0040.02017.69
7.0.50.0040.02117.80
7.0.40.0060.03315.81
7.0.30.0060.02115.81
7.0.20.0020.03615.72
7.0.10.0080.02915.80
7.0.00.0090.01715.75
5.6.400.0080.00714.51
5.6.390.0080.00714.69
5.6.380.0070.00514.60
5.6.370.0020.00914.54
5.6.360.0060.00814.66
5.6.350.0070.00714.49
5.6.340.0020.01014.18
5.6.330.0060.00714.60
5.6.320.0060.00514.42
5.6.310.0050.00814.46
5.6.300.0020.00814.41
5.6.290.0110.00014.46
5.6.280.0030.03016.55
5.6.270.0050.00714.72
5.6.260.0030.00814.40
5.6.250.0080.00914.57
5.6.240.0020.03816.46
5.6.230.0050.03016.56
5.6.220.0100.01416.51
5.6.210.0060.03116.56
5.6.200.0070.02916.55
5.6.190.0040.02316.69
5.6.180.0070.02116.69
5.6.170.0040.02016.65
5.6.160.0060.02116.70
5.6.150.0060.02816.54
5.6.140.0090.03016.62
5.6.130.0030.03516.66
5.6.120.0060.02216.61
5.6.110.0070.03316.63
5.6.100.0020.03716.63
5.6.90.0110.02716.83
5.6.80.0080.02816.40
5.6.70.0060.02216.33
5.6.60.0010.02216.40
5.6.50.0030.02216.32
5.6.40.0070.02716.42
5.6.30.0060.01716.39
5.6.20.0060.03216.45
5.6.10.0030.03116.43
5.6.00.0050.02816.38
5.5.380.0070.03116.37
5.5.370.0050.03416.42
5.5.360.0050.01916.42
5.5.350.0060.03116.57
5.5.340.0090.02416.54
5.5.330.0030.02116.51
5.5.320.0030.03416.44
5.5.310.0060.01616.53
5.5.300.0040.03216.54
5.5.290.0050.03016.56
5.5.280.0050.02616.57
5.5.270.0030.03116.61
5.5.260.0040.03416.54
5.5.250.0050.02316.44
5.5.240.0020.02016.44
5.5.230.0010.03616.37
5.5.220.0040.02816.35
5.5.210.0050.01916.26
5.5.200.0040.03116.22
5.5.190.0030.03316.32
5.5.180.0050.02516.37
5.5.170.0080.00614.25
5.5.160.0050.01516.38
5.5.150.0080.01516.15
5.5.140.0020.03416.37
5.5.130.0080.02216.36
5.5.120.0060.02816.22
5.5.110.0010.03016.27
5.5.100.0090.01816.33
5.5.90.0050.03016.30
5.5.80.0030.02416.18
5.5.70.0050.02016.34
5.5.60.0050.02216.31
5.5.50.0030.03016.20
5.5.40.0050.03316.28
5.5.30.0040.03116.21
5.5.20.0080.02816.12
5.5.10.0040.02716.35
5.5.00.0050.02616.12
5.4.450.0020.03214.56
5.4.440.0020.03414.53
5.4.430.0050.03114.55
5.4.420.0030.02914.54
5.4.410.0040.02814.39
5.4.400.0040.01514.38
5.4.390.0040.02814.37
5.4.380.0040.03014.42
5.4.370.0060.02914.42
5.4.360.0050.01714.45
5.4.350.0050.02514.54
5.4.340.0030.02714.38
5.4.330.0000.00912.11
5.4.320.0040.01714.36
5.4.310.0020.03114.40
5.4.300.0040.02114.46
5.4.290.0010.03514.33
5.4.280.0030.02714.32
5.4.270.0050.02414.39
5.4.260.0060.01914.40
5.4.250.0030.02314.23
5.4.240.0030.02714.38
5.4.230.0010.03214.44
5.4.220.0030.02314.47
5.4.210.0030.02314.31
5.4.200.0030.03114.33
5.4.190.0060.01814.41
5.4.180.0050.02914.36
5.4.170.0060.02714.38
5.4.160.0030.02614.36
5.4.150.0030.02014.41
5.4.140.0050.02613.47
5.4.130.0030.02513.50
5.4.120.0020.03113.40
5.4.110.0050.02613.54
5.4.100.0010.02913.58
5.4.90.0040.01413.48
5.4.80.0030.03013.50
5.4.70.0030.03013.46
5.4.60.0050.02413.47
5.4.50.0050.02513.45
5.4.40.0070.01813.45
5.4.30.0050.02713.52
5.4.20.0030.01713.57
5.4.10.0050.02113.52
5.4.00.0040.01713.27
5.3.290.0040.02812.86
5.3.280.0020.02912.74
5.3.270.0020.03012.83
5.3.260.0040.03112.80
5.3.250.0050.02012.81
5.3.240.0020.03012.71
5.3.230.0060.01712.81
5.3.220.0020.03112.66
5.3.210.0080.01712.74
5.3.200.0040.02112.75
5.3.190.0040.01512.68
5.3.180.0040.02912.78
5.3.170.0020.02012.76
5.3.160.0050.02812.74
5.3.150.0040.02712.78
5.3.140.0010.03212.76
5.3.130.0010.02512.77
5.3.120.0040.03012.67
5.3.110.0030.01612.75
5.3.100.0040.02612.46
5.3.90.0020.02012.61
5.3.80.0040.02912.49
5.3.70.0030.02812.47
5.3.60.0030.02612.49
5.3.50.0030.02112.51
5.3.40.0040.02212.50
5.3.30.0010.02312.42
5.3.20.0020.02712.43
5.3.10.0060.02312.31
5.3.00.0060.02512.30
5.2.170.0070.06011.23
5.2.160.0070.03011.14
5.2.150.0030.03711.20
5.2.140.0030.06311.16
5.2.130.0030.05711.18
5.2.120.0070.05311.15
5.2.110.0000.06010.97
5.2.100.0030.06011.11
5.2.90.0000.06011.06
5.2.80.0000.06311.13
5.2.70.0000.03711.04
5.2.60.0070.05711.13
5.2.50.0070.05711.09
5.2.40.0070.04011.01
5.2.30.0000.04310.87
5.2.20.0030.03010.97
5.2.10.0030.02710.80
5.2.00.0030.02710.80
5.1.60.0070.02310.21
5.1.50.0000.02710.21
5.1.40.0070.02310.21
5.1.30.0000.03010.36
5.1.20.0070.02010.39
5.1.10.0000.02710.21
5.1.00.0000.02710.21
5.0.50.0000.02010.21
5.0.40.0030.01710.21
5.0.30.0000.03010.21
5.0.20.0030.01710.21
5.0.10.0000.02010.21
5.0.00.0000.03010.21
4.4.90.0000.03010.21
4.4.80.0000.01710.21
4.4.70.0000.01710.21
4.4.60.0000.01710.21
4.4.50.0000.01710.21
4.4.40.0070.02010.21
4.4.30.0000.01310.21
4.4.20.0000.01310.21
4.4.10.0030.01310.21
4.4.00.0000.02310.21
4.3.110.0000.01310.21
4.3.100.0000.02010.21
4.3.90.0000.01710.21
4.3.80.0000.03010.21
4.3.70.0000.01310.21
4.3.60.0000.01310.21
4.3.50.0030.01710.21
4.3.40.0000.02710.21
4.3.30.0000.01710.21
4.3.20.0030.03310.21
4.3.10.0030.02310.21
4.3.00.0000.02310.21

preferences:
63.23 ms | 400 KiB | 5 Q