Código:
Devuelve : <?php $start = new DateTime('2010-12-02'); $start->modify('first day of this month'); $end = new DateTime('2016-05-06'); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 year'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format("Y") . "<br>\n"; } ?>
Código:
¿ Como puedo hacer para que devuelve tambien 2016 ? Deberia devolverlo como lo hace con el 2010 2010 2011 2012 2013 2014 2015