fork download
  1. <?php
  2.  
  3. $start = new DateTime('2010-12-02');
  4. $end = new DateTime('2012-05-06');
  5. $interval = DateInterval::createFromDateString('1 month');
  6. $period = new DatePeriod($start, $interval, $end);
  7.  
  8. foreach ($period as $dt) {
  9. var_dump($dt->format('d/m/Y'));
  10. }
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
string(10) "02/12/2010"
string(10) "02/01/2011"
string(10) "02/02/2011"
string(10) "02/03/2011"
string(10) "02/04/2011"
string(10) "02/05/2011"
string(10) "02/06/2011"
string(10) "02/07/2011"
string(10) "02/08/2011"
string(10) "02/09/2011"
string(10) "02/10/2011"
string(10) "02/11/2011"
string(10) "02/12/2011"
string(10) "02/01/2012"
string(10) "02/02/2012"
string(10) "02/03/2012"
string(10) "02/04/2012"
string(10) "02/05/2012"