I am having a hard time getting a simple date check to work properly. I searched all the questions, and so far none of the solutions have helped me.
I want to do a loop from a certain date, until today.
What is currently happening with the below code is that its not stopping and just keeps going. When I log i, I can see the date is increasing by a day like it should. I also tried flipping the operator to <, but that caused the loop to be skipped entirely.
Any ideas?
$startOfPlayoffs = new DateTime( "2016-04-29" );
$today = date("Y-m-d");
for($i = $startOfPlayoffs; $i >= $today; $i->modify('+1 day'))
{
//... some stuff
}
Interestingly, when I hard-code the date, it works fine. I.E:
$endOfPlayoffs = new DateTime( "2016-05-02" );
That isn't ideal, so was hoping to get it to work properly.