0

この関数が無限ループに陥っている理由を、私の人生では理解できません。それはおそらく私が見ていない単純なものです。年を指定すると、7/[start-year] から今月まで毎月出力されます。

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; 
}
4

0 に答える 0