- print_r: documentation ( source)
<?php
$start = (new DateTime('2014-01-01'))->modify('first day of this month');
$end = (new DateTime('2015-03-04'))->modify('first day of this month');
$interval = DateInterval::createFromDateString('1 month');
$period = new DatePeriod($start, $interval, $end);
$months = array();
foreach ($period as $dt) {
$months[] = $dt->format("F Y");
}
print_r($months);