3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new \DateTime('2018-10-31'); echo $date->format('Y-m-d').PHP_EOL; for ($i = 0; $i < 6; ++$i) { $date->modify('last day of next month'); echo $date->format('Y-m-d'); }
based on lCopS
Output for 5.6.38 - 7.3.0rc3
2018-10-31 2018-11-302018-12-312019-01-312019-02-282019-03-312019-04-30