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 = strtotime("+1 month"); if ($dnext < $dnow && $dnext < $dday) { $nextMonth = date("Y-m", strtotime($sample)); $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.70.0090.00918.56
8.3.60.0100.01016.59
8.3.50.0150.00122.08
8.3.40.0060.00918.71
8.3.30.0100.00319.09
8.3.20.0040.00420.25
8.3.10.0040.00423.63
8.3.00.0080.00020.66
8.2.180.0090.00616.88
8.2.170.0090.01322.96
8.2.160.0130.00022.25
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00422.39
8.2.110.0070.00319.30
8.2.100.0080.00417.91
8.2.90.0040.00419.53
8.2.80.0000.00817.97
8.2.70.0060.00317.88
8.2.60.0000.00818.16
8.2.50.0080.00018.07
8.2.40.0000.01018.16
8.2.30.0040.00418.32
8.2.20.0000.00817.86
8.2.10.0040.00417.98
8.2.00.0040.00418.04
8.1.280.0120.00325.92
8.1.270.0080.00023.95
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0090.00921.05
8.1.230.0060.00617.66
8.1.220.0030.00617.89
8.1.210.0030.00618.77
8.1.200.0060.00317.60
8.1.190.0000.00817.60
8.1.180.0000.00818.10
8.1.170.0100.00018.82
8.1.160.0110.00022.11
8.1.150.0040.00418.97
8.1.140.0040.00417.72
8.1.130.0070.00017.89
8.1.120.0000.00717.64
8.1.110.0030.00617.80
8.1.100.0040.00417.78
8.1.90.0030.00517.76
8.1.80.0000.00717.66
8.1.70.0040.00417.59
8.1.60.0060.00317.70
8.1.50.0060.00317.63
8.1.40.0000.00917.80
8.1.30.0040.00417.78
8.1.20.0040.00417.74
8.1.10.0000.00717.73
8.1.00.0040.00417.86
8.0.300.0030.00618.77
8.0.290.0080.00317.00
8.0.280.0030.00318.53
8.0.270.0000.00717.47
8.0.260.0000.00717.02
8.0.250.0000.00717.14
8.0.240.0000.00717.20
8.0.230.0000.00717.24
8.0.220.0030.00317.08
8.0.210.0030.00317.16
8.0.200.0030.00317.23
8.0.190.0060.00317.24
8.0.180.0040.00417.17
8.0.170.0000.00717.20
8.0.160.0070.00017.23
8.0.150.0000.00717.14
8.0.140.0040.00417.05
8.0.130.0000.00513.59
8.0.120.0000.00817.00
8.0.110.0030.00517.12
8.0.100.0040.00417.03
8.0.90.0000.00717.21
8.0.80.0060.01017.13
8.0.70.0050.00317.27
8.0.60.0030.00617.13
8.0.50.0000.00716.98
8.0.30.0130.00717.25
8.0.20.0100.00817.40
8.0.10.0060.00317.33
8.0.00.0130.00917.04
7.4.330.0000.00515.29
7.4.320.0030.00316.73
7.4.300.0030.00316.82
7.4.290.0070.00316.85
7.4.280.0000.00716.71
7.4.270.0000.00816.88
7.4.260.0030.00316.80
7.4.250.0040.00416.69
7.4.240.0020.00516.81
7.4.230.0000.00816.86
7.4.220.0070.01316.87
7.4.210.0100.00416.81
7.4.200.0030.00316.62
7.4.190.0000.00816.77
7.4.160.0100.00616.64
7.4.150.0130.00717.40
7.4.140.0120.01017.86
7.4.130.0100.00716.77
7.4.120.0090.01016.68
7.4.110.0130.00316.71
7.4.100.0060.01416.89
7.4.90.0100.01316.67
7.4.80.0140.00716.75
7.4.70.0080.00816.81
7.4.60.0100.01016.71
7.4.50.0000.00916.91
7.4.40.0130.00322.77
7.4.30.0110.00416.79
7.4.00.0080.00514.86
7.3.330.0050.00013.16
7.3.320.0030.00313.21
7.3.310.0000.00716.45
7.3.300.0000.00616.38
7.3.290.0120.00616.46
7.3.280.0050.01216.45
7.3.270.0030.01317.40
7.3.260.0090.01216.65
7.3.250.0080.00916.62
7.3.240.0070.01116.48
7.3.230.0140.00416.52
7.3.210.0060.01216.58
7.3.200.0200.00719.39
7.3.190.0080.01116.45
7.3.180.0160.00016.60
7.3.170.0130.00716.77
7.3.160.0090.00616.48
7.3.120.0030.01315.22
7.3.110.0080.00815.18
7.3.100.0040.01214.72
7.3.90.0030.00715.07
7.3.80.0030.01014.82
7.3.70.0100.00315.05
7.3.60.0130.00015.09
7.3.50.0030.01315.05
7.3.40.0060.00914.80
7.3.30.0040.01215.08
7.3.20.0070.00717.00
7.3.10.0080.00516.89
7.3.00.0050.01016.72
7.2.330.0120.00616.83
7.2.320.0180.00016.80
7.2.310.0000.01817.07
7.2.300.0150.01516.91
7.2.290.0030.01416.80
7.2.240.0060.01315.39
7.2.230.0090.00614.96
7.2.220.0110.00615.21
7.2.210.0060.00615.37
7.2.200.0040.01115.25
7.2.190.0000.01715.41
7.2.180.0090.00015.16
7.2.170.0120.00315.21
7.2.160.0100.01015.22
7.2.150.0070.00717.02
7.2.140.0040.01117.27
7.2.130.0080.00517.19
7.2.120.0090.00917.10
7.2.110.0050.01117.09
7.2.100.0000.01316.98
7.2.90.0090.00717.13
7.2.80.0040.00916.99
7.2.70.0020.01017.19
7.2.60.0140.00417.08
7.2.50.0060.00917.00
7.2.40.0030.01117.14
7.2.30.0030.01316.96
7.2.20.0070.00817.13
7.2.10.0060.00817.15
7.2.00.0020.01017.92
7.1.330.0090.00616.13
7.1.320.0070.00416.20
7.1.310.0030.01116.12
7.1.300.0040.00815.92
7.1.290.0030.00715.84
7.1.280.0070.01016.01
7.1.270.0000.01616.18
7.1.260.0100.00315.99
7.1.250.0050.01016.04
7.1.100.0060.00618.24
7.1.70.0060.00317.59
7.1.60.0140.01119.29
7.1.50.0040.01417.24
7.1.00.0000.08022.31
7.0.200.0100.00316.80
7.0.140.0000.07321.97
7.0.100.0100.08320.07
7.0.90.0070.04319.95
7.0.80.0070.08719.97
7.0.70.0070.05019.89
7.0.60.0070.04719.84
7.0.50.0070.07020.42
7.0.40.0130.07720.11
7.0.30.0130.07720.05
7.0.20.0130.08020.18
7.0.10.0070.07020.09
7.0.00.0070.08720.07
5.6.280.0030.07321.05
5.6.250.0000.04020.67
5.6.240.0130.07320.73
5.6.230.0200.07020.69
5.6.220.0070.06720.59
5.6.210.0070.05720.66
5.6.200.0130.08020.96
5.6.190.0200.03721.01
5.6.180.0130.04321.11
5.6.170.0070.07720.96
5.6.160.0070.04321.06
5.6.150.0100.07321.08
5.6.140.0130.07721.06
5.6.130.0030.08321.00
5.6.120.0130.06720.94
5.6.110.0030.08321.09
5.6.100.0100.03721.02
5.6.90.0030.08720.94
5.6.80.0000.05720.46
5.6.70.0130.07020.46
5.6.60.0100.07720.39
5.6.50.0100.07720.41
5.6.40.0130.07020.37
5.6.30.0030.07720.38
5.6.20.0030.07720.41
5.6.10.0100.07020.38
5.6.00.0130.07020.30
5.5.380.0130.07320.34
5.5.370.0130.07720.52
5.5.360.0100.08320.34
5.5.350.0170.04320.44
5.5.340.0070.08320.87
5.5.330.0130.07720.91
5.5.320.0130.08320.87
5.5.310.0070.04720.89
5.5.300.0000.08320.83
5.5.290.0100.08720.65
5.5.280.0000.05720.81
5.5.270.0100.04720.90
5.5.260.0030.05320.88
5.5.250.0070.08720.64
5.5.240.0070.07320.28
5.5.230.0130.07320.32
5.5.220.0100.06020.15
5.5.210.0170.07320.11
5.5.200.0130.05320.26
5.5.190.0030.04020.24
5.5.180.0030.08020.27
5.5.160.0130.07020.23
5.5.150.0070.06320.25
5.5.140.0100.08020.21
5.5.130.0070.04320.04
5.5.120.0070.06320.18
5.5.110.0070.04720.27
5.5.100.0070.06019.93
5.5.90.0030.08020.15
5.5.80.0170.07020.07
5.5.70.0230.03320.11
5.5.60.0100.06720.00
5.5.50.0230.06020.09
5.5.40.0070.07020.11
5.5.30.0170.06020.05
5.5.20.0100.04720.11
5.5.10.0100.04320.06
5.5.00.0100.04320.11
5.4.450.0070.08719.40
5.4.440.0130.08319.46
5.4.430.0070.07719.38
5.4.420.0130.07019.30
5.4.410.0030.05319.17
5.4.400.0070.08019.23
5.4.390.0100.07719.22
5.4.380.0130.06718.97
5.4.370.0030.03319.05
5.4.360.0130.07019.03
5.4.350.0130.07318.79
5.4.340.0030.07319.23
5.4.320.0030.04319.09
5.4.310.0070.08018.98
5.4.300.0070.04018.97
5.4.290.0200.02319.22
5.4.280.0000.04718.78
5.4.270.0100.06719.02
5.4.260.0200.06319.11
5.4.250.0130.03319.04
5.4.240.0130.07018.96
5.4.230.0030.08718.95
5.4.220.0000.06019.02
5.4.210.0100.04318.96
5.4.200.0070.07718.78
5.4.190.0030.05019.06
5.4.180.0100.04318.88
5.4.170.0030.05019.09
5.4.160.0170.07318.95
5.4.150.0130.07719.10
5.4.140.0030.08016.39
5.4.130.0100.06716.06
5.4.120.0070.06016.14
5.4.110.0100.04016.41
5.4.100.0000.04316.32
5.4.90.0130.05716.31
5.4.80.0030.04716.41
5.4.70.0070.04716.38
5.4.60.0170.05016.29
5.4.50.0130.06716.38
5.4.40.0100.06316.25
5.4.30.0030.07716.30
5.4.20.0130.06316.24
5.4.10.0070.07016.27
5.4.00.0100.04715.67
5.3.290.0170.07014.51
5.3.280.0130.06714.52
5.3.270.0130.07714.48
5.3.260.0070.08314.61
5.3.250.0030.07014.56
5.3.240.0100.05714.63
5.3.230.0200.06714.43
5.3.220.0030.05014.51
5.3.210.0000.06014.43
5.3.200.0030.07314.44
5.3.190.0030.04014.54
5.3.180.0070.06714.41
5.3.170.0000.04314.57
5.3.160.0130.07014.44
5.3.150.0100.06714.49
5.3.140.0000.07314.55
5.3.130.0000.06314.55
5.3.120.0070.08714.57
5.3.110.0100.07014.38
5.3.100.0070.04313.96
5.3.90.0100.06713.85
5.3.80.0100.06013.98
5.3.70.0070.07714.02
5.3.60.0070.07314.00
5.3.50.0100.07313.90
5.3.40.0070.07013.93
5.3.30.0030.05013.87
5.3.20.0100.03713.68
5.3.10.0030.07313.55
5.3.00.0100.07013.51
5.2.170.0070.03311.25
5.2.160.0030.06311.25
5.2.150.0100.05711.25
5.2.140.0030.03711.25
5.2.130.0030.05311.25
5.2.120.0030.06311.25
5.2.110.0070.06011.25
5.2.100.0100.06011.25
5.2.90.0100.05311.25
5.2.80.0100.05311.25
5.2.70.0030.03711.25
5.2.60.0030.04711.25
5.2.50.0030.06311.25
5.2.40.0070.05711.25
5.2.30.0100.06011.25
5.2.20.0030.06011.25
5.2.10.0030.04711.25
5.2.00.0070.06011.25
5.1.60.0070.06711.25
5.1.50.0070.05011.25
5.1.40.0030.04311.25
5.1.30.0030.04311.25
5.1.20.0000.05711.25
5.1.10.0030.04311.25
5.1.00.0000.03711.25
5.0.50.0030.02311.25
5.0.40.0030.04311.25
5.0.30.0030.03711.25
5.0.20.0100.01711.25
5.0.10.0030.04311.25
5.0.00.0000.06711.25
4.4.90.0030.03311.25
4.4.80.0030.02311.25
4.4.70.0070.03011.25
4.4.60.0100.03011.25
4.4.50.0070.03011.25
4.4.40.0000.04711.25
4.4.30.0030.03711.25
4.4.20.0030.03311.25
4.4.10.0030.03311.25
4.4.00.0000.05711.25
4.3.110.0000.04711.25
4.3.100.0070.01311.25
4.3.90.0030.01711.25
4.3.80.0000.05711.25
4.3.70.0000.03711.25
4.3.60.0030.02711.25
4.3.50.0100.02711.25
4.3.40.0030.05011.25
4.3.30.0000.02311.25
4.3.20.0030.01311.25
4.3.10.0070.03311.25
4.3.00.0000.03711.25

preferences:
53.24 ms | 401 KiB | 5 Q