Mortgage calculator PHP Implementation Example code (equal interest, equal principal)

Source: Internet
Author: User
Tags pow
The following small series for everyone to bring a PHP mortgage calculator instance Code, equal and principal interest, equal to the principal. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.