This article mainly introduces PHP to implement the method of mortgage calculator, interested in the friend's reference, I hope to help you.
Examples are as follows:
DEBX (); function Debx () {$dkm = 240;//Loan month, 20 is 240 months $dkTotal = 10000;//Total loan $dknl = 0.0515;//Loan annual interest rate $emT Otal = $dkTotal * $DKNL/12 * POW (1 + $dknl/12, $dkm)/(POW (1 + $dknl/12, $dkm)-1); Monthly repayment Amount $lxTotal = 0; Total interest for ($i = 0; $i < $dkm; $i + +) {$LX = $dkTotal * $DKNL/12; Monthly repayment Interest $em = $emTotal-$LX; Monthly repayment principal echo "first". ($i + 1). "Period", "Principal:", $em, "interest:". $LX, "total:". $emTotal, "<br/>"; $dkTotal = $dkTotal-$em; $lxTotal = $lxTotal + $lx; } echo "Total interest:". $lxTotal; } function Debj () {$dkm = 240;//Loan month, 20 is 240 months $dkTotal = 10000;//Total loan $dknl = 0.0515;//Loan Rate $em = $dkTotal/$dkm; Repayment principal $lxTotal per month = 0; Total interest for ($i = 0; $i < $dkm; $i + +) {$LX = $dkTotal * $DKNL/12;//monthly repayment interest echo "first". ($i + 1). "Period", "Principal:", $em, "interest:". $LX, "total:". ($em + $lx), "<br/>"; $dkTotal-= $em; $lxTotal = $lXtotal + $lx; } echo "Total interest:". $lxTotal; } exit;
The above is the whole content of this article, I hope that everyone's study has helped.