3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = []; $start = new \DateTime('2016-11-12'); $start->modify('monday this week'); $end = new \DateTime('2017-05-06'); $end->modify('monday next week'); $p = new \DatePeriod( $start, new \DateInterval('P1W'), $end ); foreach ($p as $d) { $y = $d->format("Y"); $m = $d->format("M"); if (!array_key_exists($y, $result['years'])){ $result['years'][$y] = ['y' => $y]; } $result['years'][$y]['months'][$d->format("m")] = ['m' => $m]; //$result[$d->format("Y")][$d->format("M")][] = [$d, (clone $d)->modify("sunday this week")]; } print_r($result); exit; foreach ($result as $year => $months){ echo $year . PHP_EOL; foreach ($months as $month => $weeks){ echo "--" . $month . PHP_EOL; foreach ($weeks as $week){ echo "----" . $week[0]->format("jM") . "-" . $week[1]->format("jM") . PHP_EOL; } } } exit; $start = new DateTime('2010-12-02'); $start->modify('first day of this month'); $end = new DateTime('2012-05-06'); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format("Y-m") . PHP_EOL; $interval_1 = DateInterval::createFromDateString('1 week'); $end_1 = clone $dt; $end_1->add($interval); $period_1 = new DatePeriod($dt, $interval_1, $end_1); foreach ($period_1 as $dt_1){ echo "--" . $dt_1->format("Y-m-d") . PHP_EOL; } }

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.0160.00618.64
8.3.60.0110.01117.00
8.3.50.0100.00921.19
8.3.40.0120.00918.96
8.3.30.0040.01118.96
8.3.20.0080.00018.88
8.3.10.0040.00421.73
8.3.00.0030.00619.63
8.2.180.0150.00717.13
8.2.170.0070.00722.96
8.2.160.0110.00420.29
8.2.150.0070.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00021.13
8.2.120.0000.00826.35
8.2.110.0090.00022.43
8.2.100.0120.00018.06
8.2.90.0050.00318.02
8.2.80.0030.00519.45
8.2.70.0080.00018.15
8.2.60.0000.00918.29
8.2.50.0060.00318.34
8.2.40.0040.00420.52
8.2.30.0070.00019.60
8.2.20.0050.00218.36
8.2.10.0000.00718.24
8.2.00.0030.00518.10
8.1.280.0110.00725.92
8.1.270.0030.00622.20
8.1.260.0000.00828.09
8.1.250.0070.00028.09
8.1.240.0060.00322.29
8.1.230.0070.00420.88
8.1.220.0030.00617.91
8.1.210.0050.00318.97
8.1.200.0000.00817.72
8.1.190.0080.00017.48
8.1.180.0090.00018.10
8.1.170.0050.00318.90
8.1.160.0030.00720.70
8.1.150.0040.00720.36
8.1.140.0050.00219.61
8.1.130.0080.00017.93
8.1.120.0040.00417.80
8.1.110.0040.00417.71
8.1.100.0070.00017.69
8.1.90.0040.00417.75
8.1.80.0040.00417.77
8.1.70.0070.00017.80
8.1.60.0000.00917.71
8.1.50.0000.00817.75
8.1.40.0050.00317.66
8.1.30.0040.00417.85
8.1.20.0040.00417.89
8.1.10.0040.00417.78
8.1.00.0030.00617.82
8.0.300.0000.00820.14
8.0.290.0090.00017.13
8.0.280.0030.00518.55
8.0.270.0000.00717.34
8.0.260.0030.00317.47
8.0.250.0060.00417.30
8.0.240.0040.00417.28
8.0.230.0070.00017.18
8.0.220.0070.00017.28
8.0.210.0040.00417.14
8.0.200.0030.00317.23
8.0.190.0050.00317.32
8.0.180.0000.00717.23
8.0.170.0000.00717.20
8.0.160.0050.00317.34
8.0.150.0030.00317.10
8.0.140.0040.00417.11
8.0.130.0000.00513.61
8.0.120.0050.00317.18
8.0.110.0040.00417.16
8.0.100.0000.00717.23
8.0.90.0040.00417.13
8.0.80.0070.00717.29
8.0.70.0000.00817.29
8.0.60.0000.00717.26
8.0.50.0040.00417.26
8.0.30.0070.01017.39
8.0.20.0080.01217.47
8.0.10.0040.00417.40
8.0.00.0100.01317.09
7.4.330.0030.00315.55
7.4.320.0030.00316.74
7.4.300.0060.00016.80
7.4.290.0000.00716.73
7.4.280.0060.00316.68
7.4.270.0030.00316.75
7.4.260.0050.00216.79
7.4.250.0030.00316.81
7.4.240.0040.00416.71
7.4.230.0000.00816.79
7.4.220.0040.01616.67
7.4.210.0020.01616.73
7.4.200.0060.00316.64
7.4.160.0060.01116.84
7.4.150.0120.01517.40
7.4.140.0120.00617.86
7.4.130.0130.00516.88
7.4.120.0110.00816.82
7.4.110.0090.00916.66
7.4.100.0160.00717.03
7.4.90.0030.01417.02
7.4.80.0060.01519.39
7.4.70.0030.01316.57
7.4.60.0060.01016.79
7.4.50.0070.01016.88
7.4.40.0130.00616.69
7.4.30.0110.00616.77
7.4.00.0050.01115.31
7.3.330.0060.00313.61
7.3.320.0060.00013.50
7.3.310.0030.00516.66
7.3.300.0070.00016.61
7.3.290.0000.00716.54
7.3.280.0090.01116.63
7.3.270.0080.01517.40
7.3.260.0130.00716.77
7.3.250.0060.01216.65
7.3.240.0130.01016.85
7.3.230.0110.00716.61
7.3.210.0150.00316.69
7.3.200.0070.01016.64
7.3.190.0100.00716.59
7.3.180.0040.01716.88
7.3.170.0060.01216.74
7.3.160.0170.00016.72
7.3.120.0150.00415.30
7.3.110.0070.01015.08
7.3.100.0070.01315.23
7.3.90.0030.01515.23
7.3.80.0070.01015.14
7.3.70.0000.01215.12
7.3.60.0000.01415.22
7.3.50.0090.00915.04
7.3.40.0000.01414.85
7.3.30.0080.00415.21
7.3.20.0080.00616.75
7.3.10.0030.01316.93
7.3.00.0070.00717.11
7.2.330.0080.00817.10
7.2.320.0060.01216.84
7.2.310.0170.00016.80
7.2.300.0090.01516.84
7.2.290.0040.01316.92
7.2.250.0070.01115.07
7.2.240.0100.01015.43
7.2.230.0130.00715.15
7.2.220.0060.00315.41
7.2.210.0030.01315.37
7.2.200.0000.01815.18
7.2.190.0070.00415.45
7.2.180.0110.00615.22
7.2.170.0000.01415.30
7.2.00.0050.00819.72
7.1.330.0090.00616.10
7.1.320.0030.00916.08
7.1.310.0140.00315.73
7.1.300.0040.01116.23
7.1.290.0070.01116.05
7.1.280.0060.00316.09
7.1.270.0000.01516.10
7.1.260.0080.00516.15
7.1.200.0040.00716.16
7.1.70.0060.00617.59
7.1.60.0110.00717.39
7.1.00.0070.07322.40
7.0.200.0070.01117.01
7.0.130.0070.05722.14
7.0.120.0170.05322.10
7.0.110.0030.06321.95
7.0.100.0070.05722.09
7.0.90.0100.05322.15
7.0.80.0130.05322.15
7.0.70.0130.05022.03
7.0.60.0130.05322.03
7.0.50.0130.05322.10
7.0.40.0100.05322.13
7.0.30.0100.05322.09
7.0.20.0100.05722.05
7.0.10.0100.05722.06
7.0.00.0130.05322.04
5.6.280.0030.06321.02
5.6.270.0230.06321.13
5.6.260.0030.06020.87
5.6.250.0070.05720.81
5.6.240.0100.06721.14
5.6.230.0100.06021.09
5.6.220.0030.06021.02
5.6.210.0000.06321.05
5.6.200.0070.06021.04
5.6.190.0130.05320.95
5.6.180.0030.06720.89
5.6.170.0130.05020.82
5.6.160.0070.06020.95
5.6.150.0130.05321.04
5.6.140.0230.05021.02
5.6.130.0130.05320.85
5.6.120.0130.05720.86
5.6.110.0170.05320.88
5.6.100.0100.06321.02
5.6.90.0130.05321.04
5.6.80.0170.04720.24
5.6.70.0030.07020.32
5.6.60.0130.05320.16
5.6.50.0170.04720.24
5.6.40.0130.05320.21
5.6.30.0170.05720.23
5.6.20.0030.06020.20
5.6.10.0200.04020.18
5.6.00.0130.05020.37

preferences:
36.66 ms | 401 KiB | 5 Q