$end_date = new DateTime($_GET['end_date']);
$last_day_this_month = $end_date->format('d-m-Y'); //outputs 10-03-2015
$start_date = new DateTime($_GET['start_date']);
$loop_dates = $start_date->format('d-m-Y'); //outputs 22-04-2015
for($i = $loop_dates; $i <= $last_day_this_month; $i++)
{
echo $i;echo '<br>';
}
Using below loop increments the year and not dates
for($i = $loop_dates; $i <= $last_day_this_month; $i++)
How could I traverse/increment through start/end dates using loop so that it outputs all the dates from 10-03-2015
to 22-04-2015
.
P.S: I am using PHP5.3
and so want to go with object oriented approach instead of using strtotime