3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nextMonday = new \DateTime(date('Y-m-d') . ' previous Monday'); echo $nextMonday->format('Y-m-d') . "\n"; for ($i=1 ; $i<=9 ; ++$i) { $nextMonday->sub(new DateInterval('P7D')); echo $nextMonday->format('Y-m-d') . "\n"; }
Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
2019-04-22 2019-04-15 2019-04-08 2019-04-01 2019-03-25 2019-03-18 2019-03-11 2019-03-04 2019-02-25 2019-02-18

preferences:
136.28 ms | 408 KiB | 5 Q