3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $period = new \DatePeriod( (new \DateTime("last day of -6 month"))->setTime(23, 59, 59), new \DateInterval('P1M'), new \DateTime() ); foreach ($period as $until) { echo $until->format("d/m/Y H:i:s")."\n"; }
based on oWedA
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0alpha1
30/11/2017 23:59:59 30/12/2017 23:59:59 30/01/2018 23:59:59 02/03/2018 23:59:59 02/04/2018 23:59:59 02/05/2018 23:59:59