3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sample1 = "2010-01-31"; $sample1a = "2010-01-01"; $dnow = date("t",strtotime($sample1)); $dnext = date("t",strtotime($sample1a . " +1 month")); $dday = date("d",strtotime($sample1)); $output = date("Y-m-d",strtotime($sample1 . " +1 month")); echo '/' . $dnow . '/' . $dnext . '/' . $dday . '/'; echo "\n"; if ($dnext < $dnow && $dnext < $dday) { $nextMonth = date("Y-m", strtotime($sample1)); $nextMonth = date("Y-m", strtotime($nextMonth . " +1 month")); $output = $nextMonth . '-' . $dnext; } echo $output; echo "\n"; $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.0140.00018.68
8.3.50.0140.00316.69
8.3.40.0150.00418.70
8.3.30.0140.00418.74
8.3.20.0080.00018.79
8.3.10.0060.00320.62
8.3.00.0040.00417.50
8.2.180.0150.00016.75
8.2.170.0070.00722.96
8.2.160.0090.00622.13
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0040.00420.08
8.2.110.0040.00721.06
8.2.100.0090.00318.16
8.2.90.0070.00319.35
8.2.80.0090.00018.15
8.2.70.0040.00417.75
8.2.60.0090.00017.93
8.2.50.0050.00318.07
8.2.40.0030.00518.28
8.2.30.0040.00418.23
8.2.20.0080.00017.98
8.2.10.0040.00418.01
8.2.00.0030.00618.13
8.1.280.0070.01025.92
8.1.270.0090.00924.66
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0000.00919.16
8.1.230.0090.00320.98
8.1.220.0050.00317.80
8.1.210.0030.00618.97
8.1.200.0070.00417.47
8.1.190.0090.00017.64
8.1.180.0040.00418.10
8.1.170.0030.00519.03
8.1.160.0070.00018.95
8.1.150.0020.00518.96
8.1.140.0100.00017.74
8.1.130.0030.00317.85
8.1.120.0000.00717.63
8.1.110.0060.00317.57
8.1.100.0040.00417.64
8.1.90.0000.00717.74
8.1.80.0000.00717.74
8.1.70.0000.00717.70
8.1.60.0040.00417.78
8.1.50.0060.00317.75
8.1.40.0000.00717.75
8.1.30.0090.00017.85
8.1.20.0040.00417.93
8.1.10.0040.00417.68
8.1.00.0040.00417.75
8.0.300.0040.00420.09
8.0.290.0040.00417.00
8.0.280.0040.00418.65
8.0.270.0070.00017.43
8.0.260.0040.00418.86
8.0.250.0040.00417.16
8.0.240.0040.00717.15
8.0.230.0070.00017.22
8.0.220.0030.00317.14
8.0.210.0040.00417.23
8.0.200.0040.00417.09
8.0.190.0030.00517.14
8.0.180.0020.00517.08
8.0.170.0030.00717.16
8.0.160.0030.00617.25
8.0.150.0040.00417.09
8.0.140.0070.00017.10
8.0.130.0050.00013.59
8.0.120.0030.00617.02
8.0.110.0030.00317.15
8.0.100.0050.00217.21
8.0.90.0070.00017.02
8.0.80.0100.01017.17
8.0.70.0020.00517.12
8.0.60.0070.00017.12
8.0.50.0030.00516.98
8.0.30.0140.00817.38
8.0.20.0100.01717.33
8.0.10.0040.00417.23
8.0.00.0150.00717.04
7.4.330.0000.00614.96
7.4.320.0000.00616.83
7.4.300.0030.00316.68
7.4.290.0030.00316.73
7.4.280.0030.00916.74
7.4.270.0000.00716.72
7.4.260.0000.00613.43
7.4.250.0080.00016.86
7.4.240.0030.00316.84
7.4.230.0030.00516.66
7.4.220.0150.00016.76
7.4.210.0060.00916.81
7.4.200.0030.00316.71
7.4.190.0080.00016.87
7.4.160.0100.00616.72
7.4.150.0070.01117.07
7.4.140.0110.00917.33
7.4.130.0080.01416.86
7.4.120.0110.00616.78
7.4.110.0090.01216.91
7.4.100.0130.00516.89
7.4.90.0090.00916.86
7.4.80.0150.00318.80
7.4.70.0030.01516.59
7.4.60.0070.01016.88
7.4.50.0030.00616.69
7.4.40.0090.00621.94
7.4.30.0140.00316.59
7.4.00.0080.00814.95
7.3.330.0000.00713.23
7.3.320.0060.00013.28
7.3.310.0000.00716.42
7.3.300.0000.00716.41
7.3.290.0060.01216.44
7.3.280.0080.00816.49
7.3.270.0160.01017.07
7.3.260.0060.01118.24
7.3.250.0080.01016.49
7.3.240.0120.01216.52
7.3.230.0070.01016.49
7.3.210.0090.00916.67
7.3.200.0130.00319.39
7.3.190.0060.01216.86
7.3.180.0100.00616.80
7.3.170.0060.00916.73
7.3.160.0030.01616.68
7.3.120.0090.00915.09
7.3.110.0060.01314.89
7.3.100.0100.01015.14
7.3.90.0070.00715.28
7.3.80.0000.00914.88
7.3.70.0030.01315.00
7.3.60.0150.00014.98
7.3.50.0080.00015.02
7.3.40.0000.01615.16
7.3.30.0000.00915.06
7.3.20.0070.00716.94
7.3.10.0080.00616.78
7.3.00.0080.00316.78
7.2.330.0100.01016.90
7.2.320.0090.01317.02
7.2.310.0030.01516.96
7.2.300.0120.00617.06
7.2.290.0100.00617.07
7.2.250.0110.01115.28
7.2.240.0100.01015.07
7.2.230.0060.00915.28
7.2.220.0040.01115.25
7.2.210.0120.00615.55
7.2.200.0030.01015.29
7.2.190.0080.00615.39
7.2.180.0060.00315.34
7.2.170.0040.01115.47
7.2.160.0060.00615.21
7.2.150.0070.00316.90
7.2.140.0090.00017.10
7.2.130.0050.00617.15
7.2.120.0020.01117.18
7.2.110.0030.00617.10
7.2.100.0030.00817.09
7.2.90.0060.00717.24
7.2.80.0050.00617.26
7.2.70.0050.00617.16
7.2.60.0050.00716.87
7.2.50.0030.00917.20
7.2.40.0100.00517.24
7.2.30.0080.01117.20
7.2.20.0040.01317.22
7.2.10.0070.00717.37
7.2.00.0040.01117.88
7.1.330.0030.01615.92
7.1.320.0090.00616.15
7.1.310.0080.00415.68
7.1.300.0090.00416.02
7.1.290.0070.00716.06
7.1.280.0040.00816.00
7.1.270.0000.01015.96
7.1.260.0000.01216.13
7.1.250.0070.00116.06
7.1.240.0030.00915.87
7.1.230.0060.00615.94
7.1.220.0110.00016.05
7.1.210.0000.01415.85
7.1.200.0070.00715.84
7.1.190.0100.00316.11
7.1.180.0060.00315.89
7.1.170.0070.00716.06
7.1.160.0060.00316.05
7.1.150.0040.01216.03
7.1.140.0040.00816.05
7.1.130.0060.00915.86
7.1.120.0060.00616.10
7.1.110.0060.00316.05
7.1.100.0040.01017.27
7.1.90.0060.00616.06
7.1.80.0000.00916.09
7.1.70.0050.00616.74
7.1.60.0050.01217.75
7.1.50.0050.00916.56
7.1.40.0100.00316.11
7.1.30.0110.00416.02
7.1.20.0030.00715.99
7.1.10.0070.01015.98
7.1.00.0050.03419.22
7.0.330.0030.00715.45
7.0.320.0100.00615.29
7.0.310.0060.00615.55
7.0.300.0030.01015.58
7.0.290.0070.00315.44
7.0.280.0120.00415.65
7.0.270.0000.01215.44
7.0.260.0000.01015.46
7.0.250.0100.00015.57
7.0.240.0060.00615.36
7.0.230.0050.00515.66
7.0.220.0030.00515.75
7.0.210.0030.01415.58
7.0.200.0040.00516.35
7.0.190.0000.00915.56
7.0.180.0070.00415.32
7.0.170.0070.01015.57
7.0.160.0100.00715.59
7.0.150.0060.00915.64
7.0.140.0050.03918.86
7.0.130.0070.00715.36
7.0.120.0060.01618.78
7.0.110.0060.00915.65
7.0.100.0090.00315.46
7.0.90.0000.01415.57
7.0.80.0080.04417.78
7.0.70.0130.04117.82
7.0.60.0050.04617.81
7.0.50.0170.03717.89
7.0.40.0070.04516.94
7.0.30.0100.02716.90
7.0.20.0070.04316.87
7.0.10.0080.04116.84
7.0.00.0120.04216.87
5.6.400.0060.00614.54
5.6.390.0070.00714.70
5.6.380.0030.00914.46
5.6.370.0100.00314.67
5.6.360.0100.00314.27
5.6.350.0000.00914.75
5.6.340.0090.00614.62
5.6.330.0030.01014.65
5.6.320.0030.00714.34
5.6.310.0100.00314.27
5.6.300.0040.01114.56
5.6.290.0040.01114.62
5.6.280.0060.04017.90
5.6.270.0040.00814.40
5.6.260.0070.00414.38
5.6.250.0060.00914.67
5.6.240.0070.00614.35
5.6.230.0080.02817.53
5.6.220.0070.04117.53
5.6.210.0100.04517.46
5.6.200.0050.03117.60
5.6.190.0020.05017.90
5.6.180.0050.04717.68
5.6.170.0050.05017.83
5.6.160.0080.02517.80
5.6.150.0080.03917.82
5.6.140.0080.04117.68
5.6.130.0080.04717.64
5.6.120.0070.04117.77
5.6.110.0030.02617.80
5.6.100.0020.04717.81
5.6.90.0070.02517.68
5.6.80.0050.04117.30
5.6.70.0050.03717.59
5.6.60.0050.02317.35
5.6.50.0090.02117.41
5.6.40.0070.02317.28
5.6.30.0050.04417.42
5.6.20.0100.02017.36
5.6.10.0050.02217.26
5.6.00.0080.02117.21
5.5.380.0090.00614.56
5.5.370.0070.03717.44
5.5.360.0100.04517.43
5.5.350.0100.02017.41
5.5.340.0070.04717.45
5.5.330.0100.03717.76
5.5.320.0070.04517.73
5.5.310.0090.04017.41
5.5.300.0100.03817.71
5.5.290.0040.04517.76
5.5.280.0000.05217.74
5.5.270.0020.02717.77
5.5.260.0080.02417.62
5.5.250.0030.02317.39
5.5.240.0070.02017.39
5.5.230.0080.02117.17
5.5.220.0020.02717.41
5.5.210.0060.02217.31
5.5.200.0000.02917.30
5.5.190.0030.02317.28
5.5.180.0080.03717.38
5.5.170.0070.00314.48
5.5.160.0020.02417.35
5.5.150.0050.02217.29
5.5.140.0060.02417.04
5.5.130.0050.02517.15
5.5.120.0050.02517.21
5.5.110.0070.02517.15
5.5.100.0030.02317.21
5.5.90.0020.03217.30
5.5.80.0120.01817.28
5.5.70.0070.03217.35
5.5.60.0050.02717.02
5.5.50.0020.02317.16
5.5.40.0060.02017.30
5.5.30.0070.02117.22
5.5.20.0120.01817.14
5.5.10.0090.02417.18
5.5.00.0060.02017.17
5.4.450.0070.03715.30
5.4.440.0080.04215.19
5.4.430.0020.02715.34
5.4.420.0090.02915.32
5.4.410.0050.02715.14
5.4.400.0020.02415.15
5.4.390.0080.02814.99
5.4.380.0020.02414.85
5.4.370.0070.02915.04
5.4.360.0060.04115.00
5.4.350.0020.03815.14
5.4.340.0050.02015.12
5.4.330.0000.00810.83
5.4.320.0050.03215.10
5.4.310.0080.01515.13
5.4.300.0040.02515.01
5.4.290.0040.02114.97
5.4.280.0000.02815.15
5.4.270.0070.01915.08
5.4.260.0030.03315.06
5.4.250.0090.01915.05
5.4.240.0040.02114.97
5.4.230.0040.02115.13
5.4.220.0080.03515.09
5.4.210.0070.02715.03
5.4.200.0060.01614.97
5.4.190.0050.03715.01
5.4.180.0050.02015.05
5.4.170.0000.02315.07
5.4.160.0040.02215.21
5.4.150.0030.02314.97
5.4.140.0030.02113.70
5.4.130.0020.02213.67
5.4.120.0020.02413.83
5.4.110.0000.02413.80
5.4.100.0080.04013.74
5.4.90.0030.03413.66
5.4.80.0050.03213.87
5.4.70.0050.04013.66
5.4.60.0080.04013.70
5.4.50.0080.02513.75
5.4.40.0100.03713.79
5.4.30.0020.02313.61
5.4.20.0070.03813.72
5.4.10.0050.04113.78
5.4.00.0050.02713.43
5.3.290.0020.02612.75
5.3.280.0000.02312.69
5.3.270.0030.02112.69
5.3.260.0030.02112.53
5.3.250.0050.01812.54
5.3.240.0000.02612.59
5.3.230.0000.02312.60
5.3.220.0030.02212.58
5.3.210.0050.02112.55
5.3.200.0060.03612.54
5.3.190.0050.02212.45
5.3.180.0070.04012.62
5.3.170.0040.03612.53
5.3.160.0030.04512.67
5.3.150.0100.03512.67
5.3.140.0030.03512.59
5.3.130.0020.02312.51
5.3.120.0020.04312.56
5.3.110.0060.03412.54
5.3.100.0020.04612.23
5.3.90.0030.03312.27
5.3.80.0040.02712.25
5.3.70.0030.02812.19
5.3.60.0050.02512.16
5.3.50.0030.04112.16
5.3.40.0000.03612.23
5.3.30.0120.03512.21
5.3.20.0060.04012.19
5.3.10.0050.03012.00
5.3.00.0060.02312.01
5.2.170.0030.06711.25
5.2.160.0000.06010.98
5.2.150.0070.06311.16
5.2.140.0030.05710.99
5.2.130.0130.05311.19
5.2.120.0000.06711.08
5.2.110.0030.04311.13
5.2.100.0070.05011.13
5.2.90.0070.04011.07
5.2.80.0030.06311.11
5.2.70.0070.04711.04
5.2.60.0130.05311.09
5.2.50.0000.06311.03
5.2.40.0070.06310.83
5.2.30.0070.05710.98
5.2.20.0030.05010.96
5.2.10.0070.05710.80
5.2.00.0070.05710.66
5.1.60.0030.04310.01
5.1.50.0030.0379.91
5.1.40.0030.04010.00
5.1.30.0030.05710.21
5.1.20.0030.05710.39
5.1.10.0000.04710.17
5.1.00.0030.05710.12
5.0.50.0030.0478.60
5.0.40.0000.0508.48
5.0.30.0030.0708.26
5.0.20.0000.0478.10
5.0.10.0030.0438.24
5.0.00.0000.0578.29
4.4.90.0070.0307.39
4.4.80.0070.0337.39
4.4.70.0030.0237.39
4.4.60.0030.0177.39
4.4.50.0070.0337.39
4.4.40.0030.0337.39
4.4.30.0000.0307.39
4.4.20.0030.0377.39
4.4.10.0070.0277.39
4.4.00.0070.0477.39
4.3.110.0070.0207.39
4.3.100.0030.0337.39
4.3.90.0000.0377.39
4.3.80.0070.0337.39
4.3.70.0070.0177.39
4.3.60.0000.0377.39
4.3.50.0030.0307.39
4.3.40.0030.0537.39
4.3.30.0000.0307.39
4.3.20.0000.0307.39
4.3.10.0000.0277.39
4.3.00.0030.0277.39

preferences:
43.94 ms | 401 KiB | 5 Q