3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $monthsData = array(); $dateBegin = new \DateTime('2018-05-01'); $dateEnd = new \DateTime('2019-01-01'); var_dump($dateBegin->getTimestamp()); while ($dateBegin->getTimestamp() < $dateEnd->getTimestamp()) { $dateBegin->format('m/Y'); $monthsData[] = $dateBegin; $dateBegin->add(new \DateInterval('P1M')); } ksort($monthsData); return $monthsData;
based on eJEWb
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0alpha1
int(1525125600)