3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @param string $start * @param string $end * * @return string[] */ function date_period_grid($start, $end) { $start = new DateTime($start); $end = new DateTime($end); $i = $end->diff($start); $days = $i->days; $months = $i->y * 12 + $i->m + ($i->d ? 1 : 0); $years = $i->y + (($i->m || $i->d) ? 1 : 0); if ($years > 1) { $period = new DatePeriod($start, new DateInterval('P1Y'), $years); } elseif ($months > 1) { $period = new DatePeriod($start, new DateInterval('P1M'), $months); } else { $period = new DatePeriod($start, new DateInterval('P1D'), $days); } $result = []; foreach ($period as $date) { $result[] = $date->format('Y-m-d'); } return $result; } var_dump(date_period_grid('2012-07-01', '2015-11-01'));

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.0030.01016.63
8.3.50.0180.00018.08
8.3.40.0150.00018.96
8.3.30.0110.00418.95
8.3.20.0110.00720.28
8.3.10.0060.00323.45
8.3.00.0030.00619.51
8.2.180.0000.01416.63
8.2.170.0110.00422.96
8.2.160.0070.00722.23
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0100.00317.88
8.2.110.0030.01022.21
8.2.100.0060.00617.93
8.2.90.0030.00619.30
8.2.80.0000.00817.97
8.2.70.0060.00318.00
8.2.60.0030.00517.93
8.2.50.0060.00318.07
8.2.40.0030.00619.39
8.2.30.0070.00020.67
8.2.20.0030.00617.99
8.2.10.0000.00918.10
8.2.00.0030.00318.30
8.1.280.0070.01425.92
8.1.270.0030.00523.96
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0040.00722.73
8.1.230.0120.00017.78
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0070.00317.48
8.1.190.0000.01017.35
8.1.180.0000.00718.10
8.1.170.0060.00318.66
8.1.160.0020.00522.02
8.1.150.0050.00218.86
8.1.140.0050.00319.69
8.1.130.0040.00417.71
8.1.120.0040.00417.75
8.1.110.0080.00017.71
8.1.100.0040.00417.67
8.1.90.0040.00417.57
8.1.80.0000.00817.73
8.1.70.0040.00417.72
8.1.60.0040.00417.70
8.1.50.0050.00517.73
8.1.40.0040.00817.73
8.1.30.0030.00517.76
8.1.20.0000.00817.68
8.1.10.0040.00417.70
8.1.00.0000.01217.75
8.0.300.0000.00718.77
8.0.290.0040.00416.88
8.0.280.0030.00318.46
8.0.270.0040.00417.37
8.0.260.0070.00017.30
8.0.250.0000.00817.20
8.0.240.0000.00717.12
8.0.230.0030.00317.11
8.0.220.0000.00717.11
8.0.210.0030.00317.06
8.0.200.0030.00317.15
8.0.190.0040.00417.09
8.0.180.0000.00717.14
8.0.170.0000.00817.12
8.0.160.0040.00417.17
8.0.150.0040.00417.05
8.0.140.0040.00417.11
8.0.130.0000.00513.55
8.0.120.0050.00316.97
8.0.110.0040.00417.17
8.0.100.0050.00217.04
8.0.90.0050.00217.01
8.0.80.0070.00717.09
8.0.70.0000.00717.09
8.0.60.0050.00217.08
8.0.50.0040.00417.19
8.0.30.0070.00717.21
8.0.20.0070.01617.40
8.0.10.0040.00417.16
8.0.00.0070.01016.88
7.4.330.0000.00615.14
7.4.320.0000.00716.75
7.4.300.0030.00316.68
7.4.290.0000.00716.82
7.4.280.0080.00016.73
7.4.270.0000.00716.66
7.4.260.0000.00716.56
7.4.250.0040.00416.71
7.4.240.0030.00416.66
7.4.230.0070.00016.68
7.4.220.0060.01316.71
7.4.210.0110.00316.79
7.4.200.0070.00016.87
7.4.160.0100.00716.54
7.4.150.0160.00417.40
7.4.140.0130.00617.86
7.4.130.0140.00316.85
7.4.120.0090.00816.53
7.4.110.0040.01316.63
7.4.100.0130.00616.78
7.4.90.0100.01016.45
7.4.80.0090.01619.39
7.4.70.0030.01416.66
7.4.60.0120.01116.75
7.4.50.0060.00316.61
7.4.40.0030.01416.48
7.4.30.0030.01316.73
7.4.00.0040.01115.29
7.3.330.0050.00013.54
7.3.320.0030.00313.33
7.3.310.0070.00016.50
7.3.300.0050.00216.51
7.3.290.0070.00716.43
7.3.280.0100.00816.41
7.3.270.0150.00317.40
7.3.260.0040.01816.45
7.3.240.0130.00416.76
7.3.230.0030.01316.66
7.3.210.0100.01416.75
7.3.200.0090.00916.55
7.3.190.0100.00716.67
7.3.180.0130.00616.54
7.3.170.0070.01016.55
7.3.160.0030.01616.63
7.2.330.0100.01316.76
7.2.320.0120.00617.02
7.2.310.0090.00917.02
7.2.300.0120.00616.77
7.2.290.0030.01516.81
7.2.60.0120.00317.05
7.2.00.0130.00019.65
7.1.200.0100.00015.97
7.1.100.0000.01418.19
7.1.70.0040.00417.12
7.1.60.0030.02019.43
7.1.50.0100.01417.23
7.1.00.0030.07722.44
7.0.200.0060.00615.20
7.0.60.0030.04320.10
7.0.50.0100.03317.91
7.0.40.0100.08320.30
7.0.30.0170.04320.11
7.0.20.0270.05720.33
7.0.10.0100.08020.15
7.0.00.0130.03720.30
5.6.280.0000.05720.91
5.6.210.0070.08020.66
5.6.200.0070.08018.18
5.6.190.0070.09020.39
5.6.180.0300.07320.61
5.6.170.0230.04020.57
5.6.160.0030.04020.50
5.6.150.0200.07018.16
5.6.140.0070.08318.27
5.6.130.0030.04018.17
5.6.120.0100.05721.03
5.6.110.0200.06721.01
5.6.100.0030.04021.15
5.6.90.0070.03721.14
5.6.80.0070.03320.52
5.5.350.0170.04320.45
5.5.340.0130.03017.96
5.5.330.0100.07720.37
5.5.320.0230.03320.35
5.5.310.0230.03320.26
5.5.300.0030.07717.94
5.5.290.0100.03317.96
5.5.280.0030.05020.91
5.5.270.0130.06320.97
5.5.260.0030.08720.85
5.5.250.0030.04020.79
5.5.240.0070.07320.18
5.4.450.0600.04719.48
5.4.440.0630.07719.47
5.4.430.0630.06319.63
5.4.420.0630.05719.38
5.4.410.0570.06019.48
5.4.400.0630.05319.09
5.4.390.0630.05319.33
5.4.380.0630.05019.13
5.4.370.0600.05318.84
5.4.360.0700.04719.15
5.4.350.0570.05719.13
5.4.340.0630.05319.06
5.4.320.0530.05718.98
5.4.310.0630.04718.98
5.4.300.0530.05319.23
5.4.290.0530.05718.86
5.4.280.0600.05019.15
5.4.270.0700.04019.01
5.4.260.0500.05719.01
5.4.250.0530.05018.86
5.4.240.0670.05019.00
5.4.230.0670.05019.27
5.4.220.0630.05019.14
5.4.210.0500.05319.28
5.4.200.0630.05019.32
5.4.190.0470.05719.36
5.4.180.0630.06018.86
5.4.170.0600.05319.14
5.4.160.0670.04319.13
5.4.150.0570.05718.98
5.4.140.0700.04716.39
5.4.130.0500.05716.61
5.4.120.0770.06016.40
5.4.110.0470.06316.64
5.4.100.0600.05016.57
5.4.90.0530.05316.63
5.4.80.0670.05316.58
5.4.70.0470.06016.46
5.4.60.0670.04016.39
5.4.50.0570.05716.44
5.4.40.0700.04016.39
5.4.30.0600.05016.54
5.4.20.0630.07016.53
5.4.10.0570.04716.59
5.4.00.0570.05016.00

preferences:
61.82 ms | 400 KiB | 5 Q