ホームページ  >  記事  >  バックエンド開発  >  何が起こっているのかを調べるのを手伝ってくれる専門家はいますか?

何が起こっているのかを調べるのを手伝ってくれる専門家はいますか?

WBOY
WBOYオリジナル
2016-06-13 13:31:41884ブラウズ

代码如下:
function amortizationTable($pNum,$periodicPayment,$balance,$monthlyInterest)
{
$paymentInterest=round ($balance*$monthlyInterest,2);
$paymentPrincipal=round ($periodicPayment-$paymentInterest ,2);
$newBalance=round ($balance-$paymentPrincipal,2);
if ($newbalance < $paymentPrincipal){
$newBalance=0;
}

printf("%d",$pNum );
printf("$%S",number_format($newBalance,2));
printf("$%S",number_format ($periodicPayment,2));
printf("$%S",number_format($paymentPrincipal,2));
printf("$%S< /td>",number_format($paymentInterest,2));
if($newBalance>0){
$pNum++;
amortizationTable($pNum,$periodicPayment,$newBalance, $monthlyInterest);
}else{
return 0;
}
}
$balance=10000.00;
$interestRate=.0575;
$monthlyInterest=$interestRate/ 12;
$termLength=5;
$paymentsPer Year=12;
$paymentNumber=1;
$totalPayments=$termLength*$paymentsPer Year;
$intCalc=1 + $interestRate/$ paymentPer Year;
$periodicPayment=$balance*pow($intCalc,$totalPayments)*($intCalc-1)/(pow($intCalc,$totalPayments)-1);
$periodicPayment=round($periodicPayment ,2);
echo"";
echo"
;";
aomrtizationTable($paymentNumber,$periodicPayment,$balance,$monthlyInterest);
echo"
支払い番号< ;/th>残高
支払い
元金
利息
";
?>
の結果は次のとおりです。

致命的エラー: C:AppServwwwtest.php の 38 行目で未定義関数 aomrtizationTable() を呼び出します
支払い番号残高支払い元本利息

---- --解決策-------------------

aomrtizationTable($paymentNumber,$periodicPayment,$balance,$monthlyInterest);amo 。 .. 不是 aom
------解决方案---------
注意大小写!
<div class="clear"> PHP コード
function amortizationTable($pNum,$periodicPayment,$balance,$monthlyInterest) {
  $paymentInterest=round ($balance*$monthlyInterest,2);
  $paymentPrincipal=round ($periodicPayment-$paymentInterest ,2);
  $newBalance=round ($balance-$paymentPrincipal,2);
  if ($newBalance < $paymentPrincipal){
    $newBalance=0;
  }

  printf("<tr>
<td>%d</td>",$pNum);
  printf("<td>$%s</td>",number_format($newBalance,2));
  printf("<td>$%s</td>",number_format($periodicPayment,2));
  printf("<td>$%s</td>",number_format($paymentPrincipal,2));
  printf("<td>$%s</td></tr>",number_format($paymentInterest,2));
  if($newBalance>0){
    $pNum++;
    amortizationTable($pNum,$periodicPayment,$newBalance,$monthlyInterest);
  }それ以外{
    0を返します。
  }
</tr>
</div>
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。