I'm trying to print dates between two other dates. Here is my code:
$begin = date("d/m/y");
$end = date("d/m/y", strtotime("+1 month"));
$i = 0;
while( strtotime($begin) <= strtotime($end) ){
echo "$begin\n";
$i++;
$begin = date("d/m/y", strtotime("+$i day") );
}
You can execute the same code here: http://sandbox.onlinephpfunctions.com/code/34c4b721553038f585806798121941bee0c66086
For some reason this code is printing just the dates between 25/01/2017 and 31/01/2017 instead of 25/01/2017 and 25/02/2017. I don't know what's wrong. Can someone help me?