How can I loop in between 2 dates?
For example, I have the following code:
//Loop through DR
$date = new DateTime();
$date_from = new DateTime($from); //'2015-08-01'
$date_to = new DateTime($to); //'2015-08'14'
$date_optput = '';
$date_compare = '';
for ($date = $date_from; $date <= $date_to; $date++):
$date_optput = $date->format('D-M-y');
echo $date_optput . '<br>';
However, this crashes my browser, ad I'm guessing because it goes through every millisecond? Which is what I don't want.
In comments I added my test data, so I am expecting the following output
Any help will be appreciated.