日付をインクリメントする関数を実行しました
これが次のとおりです。
function periode($var, $i3, $i2)
{
if($var=='52')
{
return "+ ".$i3." week";
}
if($var=='26')
{
return "+ ".($i3+2+$i3)." week";
}
if($var=='12')
{
return "+".$i3." month";
}
if($var=='6')
{
return "+ ".($i3+$i2)." month";
}
if($var=='4')
{
return "+ ".($i3+2*$i2)." month";
}
if($var=='2')
{
return "+ ".($i3+5*$i2)." month";
}
if($var=='1')
{
return "+ ".($i2)." year";
}
}
問題は、私がそのような機能を使用するとき、次のようになることです。
if($pay_periodicity==26){$i3=0;}elseif($pay_periodicity==4){$i3=0;}elseif($pay_periodicity==6){$i3=0;}else{$i3=0;}; $i2=0;
$montant_echeance = round($montant_du / $nombre_echeances, 2);
$reste=$montant_du ;
while($i2 <= $nombre_echeances)
{
echo periode($pay_periodicity,$i3,$i2);
if ($i2 == $nombre_echeances)
{
$montant_echeance = $reste;
$reste = 0;
}
$date = date("d-m-Y",strtotime((($debut)."".periode($pay_periodicity,$i3,$i2)."")));
$chaine .= "<tr>
<td>$montant_du</td>
<td>".$date."</td>
<td>$montant_echeance</td>
<td>$reste</td></tr>";
$reste = $reste-$montant_echeance;
$i2++;
++$i3;
}
$chaine .="</table>";
print "$chaine";
}
25番目の$i2の後、次のように日付が表示されます。
01-01-1970
なぜ25年以上インクリメントできないのかよくわかりません。
どんな助けやアドバイスも大歓迎です。
敬具。
SP。