3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $startTime = strtotime('2013-01-01 3:00'); $finishTime = strtotime('2013-03-01 3:00'); $lastMonthDay = strtotime(sprintf('last day of Jan'), $startTime); $dateTime = strtotime(sprintf('%s %s %s', 'Mon', '3:00', 'Jan'), $startTime); for (;$dateTime <= $lastMonthDay, $dateTime <= $finishTime; $dateTime = strtotime('+1 week', $dateTime)) { echo date ('d-m-Y H:i') . PHP_EOL; }
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
08-10-2013 13:04 08-10-2013 13:04 08-10-2013 13:04 08-10-2013 13:04 08-10-2013 13:04 08-10-2013 13:04 08-10-2013 13:04 08-10-2013 13:04