3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mesi=array(); $start = new DateTime('2014-12-01'); $start->modify('first day of this month'); $end = new DateTime('2015-05-30'); $end->modify('first day of this month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { $mesi[]= $dt->format("mY") . PHP_EOL; } var_dump($mesi);die();

preferences:
69.26 ms | 402 KiB | 5 Q