I want to iterate between two dates in php
. This is my code:
for($y=date("01/01/2017");$y<=date("01/06/2017");$y++){
echo $y . "<br>";
}
Expected output:
01/01/2017
02/01/2017
03/01/2017
04/01/2017
05/01/2017
06/01/2017...... like this till 01/06/2017
Actual output:
01/01/2017
01/01/2018
01/01/2019
01/01/2020
01/01/2021
01/01/2022....
How do I get the correct dates?
EDIT: The dates should be in dd/mm/yyyy format