- date_default_timezone_set: documentation ( source)
<?php
date_default_timezone_set('UTC');
$today = new DateTime;
//to be sure that DateInterval will work as intended
//we take the first day of the month
$fist_day_of_the_month = $tody->format('Y-m-01');
$range = new DatePeriod(
new DateTime($fist_day_of_the_month), //begin
new DateInterval('P1M'), //interval
new DateTime($fist_day_of_the_month.' +24 month') //end
);
foreach ($range as $date) {
echo $date->format('Y-m-d'), PHP_EOL;
}