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]; } if (!arrray_key_exists($d->format("m"), $result['years'][$y]['months'])){ $result['years'][$y]['months'][$d->format("m")] = ['m' => $m]; } $result['years'][$y]['months'][$m]['weeks'][] = ['f' => $d, 't' => (clone $d)->modify("sunday this week")]; //$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.60.0150.01117.00
8.3.50.0070.01016.88
8.3.40.0100.01019.09
8.3.30.0110.00418.96
8.3.20.0080.00019.04
8.3.10.0040.00422.03
8.3.00.0080.00019.63
8.2.180.0170.00316.75
8.2.170.0070.00722.96
8.2.160.0060.00920.60
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00921.04
8.2.120.0000.00826.35
8.2.110.0040.00722.34
8.2.100.0040.00818.16
8.2.90.0000.00818.28
8.2.80.0040.00419.41
8.2.70.0030.00918.18
8.2.60.0030.00518.05
8.2.50.0050.00318.34
8.2.40.0000.00820.78
8.2.30.0040.00419.39
8.2.20.0040.00418.34
8.2.10.0040.00418.28
8.2.00.0040.00418.21
8.1.280.0070.01025.92
8.1.270.0080.00022.43
8.1.260.0000.00728.09
8.1.250.0040.00428.09
8.1.240.0060.00322.32
8.1.230.0040.00721.04
8.1.220.0000.00818.04
8.1.210.0000.00818.85
8.1.200.0050.00317.73
8.1.190.0080.00817.35
8.1.180.0000.00818.10
8.1.170.0080.00018.96
8.1.160.0050.00520.80
8.1.150.0040.00420.36
8.1.140.0050.00219.79
8.1.130.0000.00917.91
8.1.120.0040.00417.68
8.1.110.0000.00717.78
8.1.100.0040.00417.78
8.1.90.0000.00717.62
8.1.80.0040.00417.80
8.1.70.0000.00717.82
8.1.60.0040.00417.75
8.1.50.0000.00817.78
8.1.40.0050.00317.75
8.1.30.0030.00517.93
8.1.20.0030.00517.81
8.1.10.0040.00417.84
8.1.00.0040.00417.69
8.0.300.0040.00420.42
8.0.290.0080.00017.13
8.0.280.0070.00018.63
8.0.270.0040.00417.36
8.0.260.0030.00317.36
8.0.250.0000.00817.25
8.0.240.0000.00817.28
8.0.230.0080.00017.20
8.0.220.0040.00417.26
8.0.210.0070.00017.29
8.0.200.0030.00317.31
8.0.190.0080.00317.34
8.0.180.0040.00417.30
8.0.170.0000.00717.34
8.0.160.0000.00717.32
8.0.150.0000.00817.25
8.0.140.0050.00217.17
8.0.130.0000.00613.60
8.0.120.0050.00317.25
8.0.110.0000.00817.08
8.0.100.0040.00417.26
8.0.90.0040.00417.30
8.0.80.0110.00417.31
8.0.70.0070.00017.25
8.0.60.0080.00017.33
8.0.50.0050.00217.25
8.0.30.0100.00817.30
8.0.20.0140.00617.40
8.0.10.0000.00717.46
8.0.00.0070.01117.32
7.4.330.0030.00315.55
7.4.320.0030.00316.77
7.4.300.0000.00616.78
7.4.290.0000.00716.86
7.4.280.0040.00416.76
7.4.270.0030.00316.80
7.4.260.0040.00316.83
7.4.250.0030.00516.89
7.4.240.0000.00716.92
7.4.230.0000.00816.56
7.4.220.0080.01216.90
7.4.210.0090.00616.77
7.4.200.0030.00616.65
7.4.160.0080.00916.90
7.4.150.0120.00617.40
7.4.140.0060.01217.86
7.4.130.0100.00716.81
7.4.120.0090.00916.82
7.4.110.0070.01016.69
7.4.100.0060.01117.01
7.4.90.0100.00616.77
7.4.80.0120.00419.39
7.4.70.0060.00916.75
7.4.60.0060.00916.88
7.4.50.0040.01116.83
7.4.40.0170.00716.98
7.4.30.0160.00016.65
7.4.00.0040.01315.37
7.3.330.0090.00013.49
7.3.320.0050.00013.50
7.3.310.0070.00016.51
7.3.300.0000.00816.68
7.3.290.0070.00016.61
7.3.280.0070.01016.66
7.3.270.0090.01317.40
7.3.260.0110.00816.80
7.3.250.0140.00616.68
7.3.240.0110.01016.85
7.3.230.0000.01716.75
7.3.210.0180.00016.65
7.3.200.0060.01016.71
7.3.190.0120.00916.83
7.3.180.0100.01016.68
7.3.170.0100.00716.61
7.3.160.0030.01316.88
7.3.120.0070.00715.09
7.3.110.0110.00715.19
7.3.100.0060.01115.16
7.3.90.0060.00815.27
7.3.80.0090.00515.08
7.3.70.0040.00915.19
7.3.60.0050.00715.12
7.3.50.0050.00615.20
7.3.40.0040.01115.27
7.3.30.0030.01115.13
7.3.20.0070.00716.99
7.3.10.0040.00916.80
7.3.00.0040.00816.98
7.2.330.0120.00617.08
7.2.320.0070.01417.08
7.2.310.0070.01017.10
7.2.300.0070.01717.10
7.2.290.0000.02116.81
7.2.250.0070.01115.39
7.2.240.0030.01715.50
7.2.230.0050.01115.54
7.2.220.0060.00515.24
7.2.210.0030.01015.46
7.2.200.0060.00815.21
7.2.190.0030.01215.13
7.2.180.0020.01115.28
7.2.170.0080.00915.37
7.2.130.0120.00017.34
7.2.120.0070.01017.29
7.2.110.0060.00316.95
7.2.100.0030.01016.96
7.2.90.0090.00617.17
7.2.80.0000.01817.01
7.2.70.0000.00916.98
7.2.60.0100.01317.02
7.2.50.0100.00717.05
7.2.40.0040.00717.29
7.2.30.0100.00717.27
7.2.20.0030.00917.31
7.2.10.0030.01017.30
7.2.00.0050.00818.59
7.1.330.0100.00515.98
7.1.320.0050.00616.03
7.1.310.0100.00316.11
7.1.300.0040.00716.09
7.1.290.0040.01115.94
7.1.280.0050.00815.92
7.1.270.0060.00815.93
7.1.260.0070.00715.96
7.1.250.0000.01616.04
7.1.200.0030.00916.12
7.1.70.0040.00417.50
7.1.60.0040.01117.41
7.1.50.0090.00317.30
7.1.00.0100.07022.40
7.0.200.0060.01117.09
7.0.130.0100.05722.02
7.0.120.0070.06022.06
7.0.110.0070.06022.07
7.0.100.0100.06022.18
7.0.90.0030.06322.08
7.0.80.0070.06022.02
7.0.70.0070.06022.11
7.0.60.0170.04721.97
7.0.50.0070.05722.07
7.0.40.0100.05722.04
7.0.30.0170.04722.13
7.0.20.0100.05322.11
7.0.10.0130.05022.03
7.0.00.0100.05322.20
5.6.280.0030.06021.14
5.6.270.0100.05321.05
5.6.260.0100.05320.98
5.6.250.0100.05720.88
5.6.240.0130.07321.08
5.6.230.0070.06020.98
5.6.220.0070.05721.03
5.6.210.0030.06020.99
5.6.200.0130.05321.03
5.6.190.0030.06320.91
5.6.180.0100.06321.02
5.6.170.0130.05020.82
5.6.160.0130.05021.02
5.6.150.0070.05720.96
5.6.140.0100.05320.81
5.6.130.0100.05021.03
5.6.120.0100.05720.99
5.6.110.0030.06021.00
5.6.100.0070.06020.84
5.6.90.0130.04721.01
5.6.80.0030.05320.20
5.6.70.0070.06720.38
5.6.60.0200.04320.14
5.6.50.0000.05720.32
5.6.40.0100.05020.41
5.6.30.0070.05320.38
5.6.20.0030.05720.36
5.6.10.0130.04720.20
5.6.00.0030.05720.15

preferences:
65.16 ms | 401 KiB | 5 Q