php - While statement infinite looping -
i can't life of me figure out why function in infinite loop. it's simple i'm not seeing. given year, prints out every month 7/[start-year] until month.
function showmonths($year) { $start = strtotime($year.'-07-01'); $end = strtotime("now"); while($end >= $start) { $months[] = strtotime("-1 month", $end); $end = strtotime("-1 month", $end); } return $months; }
Comments
Post a Comment