3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php foreach (range(0,8) as $days) { $a1 = new DateTime('2016-03-07 18:02:40'); $a1->modify("+$days days"); $a1->modify('next week'); echo $days . PHP_EOL; var_dump($a1->format('d/m/Y')); }
based on No5UM
Output for 5.6.28, 7.0.20 - 7.3.0rc3
0 string(10) "14/03/2016" 1 string(10) "14/03/2016" 2 string(10) "14/03/2016" 3 string(10) "14/03/2016" 4 string(10) "14/03/2016" 5 string(10) "14/03/2016" 6 string(10) "14/03/2016" 7 string(10) "21/03/2016" 8 string(10) "21/03/2016"
Output for 5.3.23 - 5.6.21, 7.0.0 - 7.0.6
0 string(10) "14/03/2016" 1 string(10) "14/03/2016" 2 string(10) "14/03/2016" 3 string(10) "14/03/2016" 4 string(10) "14/03/2016" 5 string(10) "14/03/2016" 6 string(10) "21/03/2016" 7 string(10) "21/03/2016" 8 string(10) "21/03/2016"