I know that to show dates between two dates in Php we can use this code
$tsDateFrom = date('2015-05-01');
$tsDateTo = date('2015-05-07');
for($i=$tsDateFrom;$i<=$tsDateTo;$i++) {
echo $thisDate = $i."<br>" ;
}
displays
2015-05-01
2015-05-02
2015-05-03
2015-05-04
2015-05-05
2015-05-06
2015-05-07
but how about this?
$tsDateFrom1 = date('2015-05-01');
$tsDateTo1 = date('2015-05-07');
for($i=$tsDateFrom1;$i<=$tsDateTo1;$i = strtotime('+1 day', $i)) {
echo $thisDate = $i."<br>";
}
displays
2015-05-01
I need explanation since I'm only new to php and I want to learn how loops works.And why the second loop return just the first date?