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 = strtotime($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.0090.00918.45
8.3.50.0140.00721.20
8.3.40.0090.00618.67
8.3.30.0110.00418.79
8.3.20.0080.00018.73
8.3.10.0000.00819.36
8.3.00.0080.00023.70
8.2.180.0110.00716.75
8.2.170.0150.00322.96
8.2.160.0090.00920.50
8.2.150.0080.00024.18
8.2.140.0050.00224.66
8.2.130.0040.00426.16
8.2.120.0050.00321.19
8.2.110.0000.01020.61
8.2.100.0070.00317.97
8.2.90.0040.00419.17
8.2.80.0030.00618.16
8.2.70.0050.00317.88
8.2.60.0000.00818.05
8.2.50.0080.00018.07
8.2.40.0000.00818.47
8.2.30.0040.00421.37
8.2.20.0040.00417.85
8.2.10.0030.00517.90
8.2.00.0070.00418.02
8.1.280.0120.00325.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0070.00322.59
8.1.230.0090.00320.86
8.1.220.0000.00918.77
8.1.210.0030.00518.89
8.1.200.0030.00617.63
8.1.190.0040.00417.66
8.1.180.0040.00418.10
8.1.170.0060.00318.78
8.1.160.0000.00819.04
8.1.150.0070.00318.74
8.1.140.0040.00417.61
8.1.130.0000.00717.90
8.1.120.0040.00417.72
8.1.110.0060.00317.76
8.1.100.0030.00517.70
8.1.90.0070.00017.68
8.1.80.0000.00817.62
8.1.70.0030.00317.66
8.1.60.0070.00417.80
8.1.50.0070.00017.61
8.1.40.0040.00417.73
8.1.30.0000.00717.79
8.1.20.0040.00417.89
8.1.10.0040.00417.71
8.1.00.0000.00717.86
8.0.300.0040.00420.18
8.0.290.0050.00317.30
8.0.280.0080.00018.52
8.0.270.0000.00717.43
8.0.260.0030.00717.12
8.0.250.0020.00517.31
8.0.240.0000.00817.11
8.0.230.0000.00717.26
8.0.220.0000.00717.05
8.0.210.0050.00717.17
8.0.200.0030.00317.24
8.0.190.0070.00017.30
8.0.180.0040.00417.07
8.0.170.0000.00717.27
8.0.160.0030.00317.14
8.0.150.0000.00717.23
8.0.140.0030.00517.18
8.0.130.0030.00313.55
8.0.120.0040.00417.13
8.0.110.0040.00417.06
8.0.100.0040.00417.20
8.0.90.0040.00417.05
8.0.80.0150.00017.15
8.0.70.0040.00417.29
8.0.60.0040.00417.17
8.0.50.0070.00016.98
8.0.30.0130.00817.27
8.0.20.0080.01517.40
8.0.10.0050.00217.30
8.0.00.0180.02117.03
7.4.330.0050.00015.02
7.4.320.0000.00616.75
7.4.300.0030.00316.82
7.4.290.0000.00816.80
7.4.280.0040.00416.72
7.4.270.0070.00016.72
7.4.260.0050.00013.42
7.4.250.0030.00516.77
7.4.240.0040.00416.73
7.4.230.0030.00316.64
7.4.220.0120.00616.70
7.4.210.0080.00816.77
7.4.200.0070.00016.64
7.4.190.0000.00716.98
7.4.160.0130.00316.71
7.4.150.0070.01117.40
7.4.140.0100.01017.86
7.4.130.0090.00916.72
7.4.120.0120.00616.82
7.4.110.0080.00816.76
7.4.100.0140.00916.81
7.4.90.0060.01216.53
7.4.80.0060.01019.39
7.4.70.0100.00616.72
7.4.60.0090.00916.76
7.4.50.0090.00016.75
7.4.40.0000.01522.77
7.4.30.0080.01116.81
7.4.10.0060.01215.04
7.4.00.0030.01015.23
7.3.330.0030.00313.16
7.3.320.0030.00313.22
7.3.310.0030.00316.39
7.3.300.0030.00316.42
7.3.290.0120.00616.34
7.3.280.0090.00916.49
7.3.270.0140.00317.40
7.3.260.0120.01018.24
7.3.250.0080.01016.63
7.3.240.0040.01216.35
7.3.230.0160.00416.49
7.3.210.0140.00416.57
7.3.200.0130.00419.39
7.3.190.0060.01316.51
7.3.180.0160.00016.60
7.3.170.0080.01216.87
7.3.160.0090.00916.59
7.3.130.0030.01615.04
7.3.120.0040.01314.99
7.3.110.0090.00614.92
7.3.100.0000.01515.21
7.3.90.0090.00314.98
7.3.80.0030.00615.05
7.3.70.0070.01015.05
7.3.60.0090.00015.05
7.3.50.0040.01115.13
7.3.40.0060.00614.80
7.3.30.0090.00015.18
7.3.20.0070.00416.81
7.3.10.0090.00616.68
7.3.00.0100.00016.86
7.2.330.0110.00616.95
7.2.320.0130.00716.97
7.2.310.0110.00716.96
7.2.300.0070.00717.03
7.2.290.0030.01317.04
7.2.260.0070.00715.21
7.2.250.0040.01515.36
7.2.240.0060.00915.23
7.2.230.0040.01115.00
7.2.220.0080.00415.15
7.2.210.0090.00615.23
7.2.200.0070.01015.53
7.2.190.0030.01415.45
7.2.180.0110.00715.08
7.2.170.0030.01015.20
7.2.160.0030.01415.37
7.2.150.0040.01417.18
7.2.140.0080.00616.84
7.2.130.0030.01017.01
7.2.120.0080.00817.18
7.2.110.0040.00717.10
7.2.100.0040.01117.18
7.2.90.0040.01417.03
7.2.80.0000.01516.90
7.2.70.0090.00617.00
7.2.60.0000.01517.04
7.2.50.0000.01816.89
7.2.40.0080.00417.00
7.2.30.0030.01217.08
7.2.20.0080.00816.93
7.2.10.0000.01417.11
7.2.00.0030.01218.25
7.1.330.0040.01115.98
7.1.320.0070.00716.13
7.1.310.0090.00316.01
7.1.300.0030.01016.03
7.1.290.0030.01015.94
7.1.280.0060.00916.12
7.1.270.0080.00015.91
7.1.260.0070.00715.70
7.1.250.0030.00616.02
7.1.240.0110.00715.89
7.1.230.0000.01116.05
7.1.220.0060.00616.16
7.1.210.0000.01216.12
7.1.200.0070.00715.89
7.1.190.0070.01015.99
7.1.180.0120.00315.95
7.1.170.0070.01015.77
7.1.160.0100.00716.11
7.1.150.0100.00316.05
7.1.140.0090.00616.01
7.1.130.0040.01415.91
7.1.120.0140.00015.81
7.1.110.0030.01316.06
7.1.100.0080.00817.27
7.1.90.0090.00315.82
7.1.80.0110.00315.90
7.1.70.0030.00716.74
7.1.60.0030.01017.63
7.1.50.0040.01716.65
7.1.40.0060.00316.13
7.1.30.0000.01116.02
7.1.20.0030.00915.93
7.1.10.0080.00616.09
7.1.00.0070.04219.32
7.0.330.0080.00815.34
7.0.320.0080.00615.39
7.0.310.0070.00315.74
7.0.300.0100.00315.74
7.0.290.0030.01015.68
7.0.280.0040.00815.48
7.0.270.0100.00315.49
7.0.260.0070.00415.63
7.0.250.0060.01015.71
7.0.240.0100.00015.57
7.0.230.0100.00315.52
7.0.220.0080.00815.72
7.0.210.0060.00615.65
7.0.200.0000.01116.20
7.0.190.0040.01115.73
7.0.180.0040.00415.69
7.0.170.0030.00715.40
7.0.160.0030.00715.33
7.0.150.0030.01015.47
7.0.140.0050.03818.86
7.0.130.0000.00915.32
7.0.120.0000.01015.65
7.0.110.0050.00515.66
7.0.100.0070.03817.74
7.0.90.0070.04917.88
7.0.80.0120.03017.84
7.0.70.0100.04617.78
7.0.60.0120.04017.84
7.0.50.0080.04717.97
7.0.40.0050.02816.89
7.0.30.0080.04216.83
7.0.20.0030.03616.91
7.0.10.0050.04216.92
7.0.00.0070.04716.91
5.6.400.0060.00314.72
5.6.390.0080.00814.66
5.6.380.0070.00814.67
5.6.370.0060.00614.45
5.6.360.0020.00714.33
5.6.350.0040.01114.68
5.6.340.0070.01014.81
5.6.330.0070.00714.17
5.6.320.0120.00314.54
5.6.310.0000.01114.47
5.6.300.0060.00614.76
5.6.290.0030.00614.28
5.6.280.0040.03817.67
5.6.270.0100.00314.75
5.6.260.0060.00614.65
5.6.250.0050.03717.49
5.6.240.0110.02317.70
5.6.230.0050.02817.41
5.6.220.0050.03817.50
5.6.210.0070.04017.43
5.6.200.0050.04817.82
5.6.190.0130.04017.79
5.6.180.0050.03017.88
5.6.170.0070.03217.73
5.6.160.0090.03017.71
5.6.150.0030.02417.60
5.6.140.0070.04317.76
5.6.130.0150.03217.67
5.6.120.0060.04617.77
5.6.110.0080.04417.71
5.6.100.0070.04217.69
5.6.90.0080.03517.69
5.6.80.0120.03617.31
5.6.70.0050.04517.37
5.6.60.0030.02517.54
5.6.50.0080.02617.38
5.6.40.0100.02417.45
5.6.30.0070.04217.45
5.6.20.0100.03317.41
5.6.10.0050.02317.55
5.6.00.0090.02617.43
5.5.380.0070.04017.38
5.5.370.0090.04817.51
5.5.360.0030.05017.47
5.5.350.0060.02717.42
5.5.340.0000.03417.64
5.5.330.0040.03117.69
5.5.320.0050.04517.81
5.5.310.0050.04817.73
5.5.300.0080.03617.57
5.5.290.0070.03017.55
5.5.280.0090.02617.57
5.5.270.0200.01717.80
5.5.260.0030.02717.72
5.5.250.0030.04417.57
5.5.240.0080.02717.26
5.5.230.0030.03117.30
5.5.220.0110.04617.36
5.5.210.0080.04217.29
5.5.200.0050.02617.31
5.5.190.0120.03717.30
5.5.180.0100.02817.21
5.5.170.0050.00514.43
5.5.160.0080.03017.33
5.5.150.0070.04317.29
5.5.140.0060.04317.05
5.5.130.0090.03817.22
5.5.120.0050.03417.09
5.5.110.0070.02217.34
5.5.100.0090.01917.26
5.5.90.0130.02017.26
5.5.80.0080.04517.29
5.5.70.0030.03017.20
5.5.60.0040.03116.96
5.5.50.0110.04017.02
5.5.40.0110.03617.30
5.5.30.0050.02917.25
5.5.20.0050.02517.06
5.5.10.0050.02517.12
5.5.00.0110.02617.21
5.4.450.0070.02515.15
5.4.440.0070.04315.30
5.4.430.0060.04015.28
5.4.420.0040.03915.15
5.4.410.0120.03315.25
5.4.400.0040.03615.00
5.4.390.0050.02114.82
5.4.380.0050.03415.05
5.4.370.0050.03614.98
5.4.360.0090.03015.00
5.4.350.0070.02214.99
5.4.340.0050.02615.04
5.4.330.0110.00011.11
5.4.320.0030.03315.01
5.4.310.0080.04015.01
5.4.300.0030.04214.94
5.4.290.0130.03315.03
5.4.280.0080.02414.96
5.4.270.0030.04215.05
5.4.260.0020.02914.97
5.4.250.0030.04015.00
5.4.240.0030.03715.07
5.4.230.0100.03715.09
5.4.220.0090.04615.06
5.4.210.0090.02314.95
5.4.200.0080.04014.94
5.4.190.0080.03915.12
5.4.180.0080.02015.05
5.4.170.0050.02414.87
5.4.160.0040.03915.09
5.4.150.0130.03014.90
5.4.140.0030.04113.76
5.4.130.0030.04213.74
5.4.120.0070.02213.74
5.4.110.0050.03213.76
5.4.100.0090.01713.60
5.4.90.0050.02813.85
5.4.80.0020.02713.67
5.4.70.0060.01813.61
5.4.60.0020.02213.81
5.4.50.0060.03413.59
5.4.40.0100.03213.61
5.4.30.0070.03913.72
5.4.20.0050.03513.60
5.4.10.0090.03613.61
5.4.00.0060.01613.26
5.3.290.0120.03612.67
5.3.280.0080.02312.54
5.3.270.0050.03112.68
5.3.260.0030.02612.67
5.3.250.0030.02312.50
5.3.240.0110.02012.62
5.3.230.0150.03012.64
5.3.220.0080.02212.50
5.3.210.0070.03612.58
5.3.200.0020.03012.53
5.3.190.0070.01712.59
5.3.180.0050.03812.61
5.3.170.0000.03512.63
5.3.160.0030.04012.63
5.3.150.0000.04212.62
5.3.140.0060.03112.43
5.3.130.0040.02512.60
5.3.120.0070.04012.55
5.3.110.0070.03912.51
5.3.100.0050.03412.22
5.3.90.0020.02712.29
5.3.80.0080.03812.17
5.3.70.0020.02312.31
5.3.60.0030.03612.21
5.3.50.0040.03512.27
5.3.40.0030.02812.26
5.3.30.0040.02412.31
5.3.20.0040.01912.06
5.3.10.0020.02311.95
5.3.00.0030.02211.89
5.2.170.0000.05711.12
5.2.160.0030.02710.95
5.2.150.0070.04011.15
5.2.140.0100.05310.99
5.2.130.0030.05010.93
5.2.120.0000.03011.04
5.2.110.0000.03011.09
5.2.100.0030.02711.07
5.2.90.0000.03010.97
5.2.80.0000.03011.06
5.2.70.0000.03310.93
5.2.60.0030.02711.12
5.2.50.0030.02711.10
5.2.40.0000.03011.06
5.2.30.0070.02710.93
5.2.20.0000.03311.00
5.2.10.0000.03010.93
5.2.00.0070.03310.82
5.1.60.0000.02310.06
5.1.50.0030.0239.91
5.1.40.0000.02310.09
5.1.30.0030.02010.44
5.1.20.0030.02010.22
5.1.10.0030.02010.18
5.1.00.0000.02310.07
5.0.50.0000.0178.64
5.0.40.0030.0178.49
5.0.30.0070.0408.32
5.0.20.0000.0338.20
5.0.10.0030.0238.23
5.0.00.0030.0278.24
4.4.90.0030.0137.08
4.4.80.0000.0177.08
4.4.70.0000.0177.08
4.4.60.0000.0177.08
4.4.50.0000.0207.08
4.4.40.0000.0237.08
4.4.30.0000.0137.08
4.4.20.0070.0077.08
4.4.10.0000.0137.08
4.4.00.0030.0237.08
4.3.110.0030.0337.08
4.3.100.0100.0207.08
4.3.90.0030.0137.08
4.3.80.0030.0307.08
4.3.70.0000.0137.08
4.3.60.0000.0137.08
4.3.50.0000.0177.08
4.3.40.0070.0277.08
4.3.30.0000.0237.08
4.3.20.0000.0177.08
4.3.10.0000.0177.08
4.3.00.0000.0137.08

preferences:
31.4 ms | 401 KiB | 5 Q