I'm a web developer, freelancer, author, speaker, entrepreneur, technical reviewer and blogger based in the North East, living in a village just outside of Chester-le-Street.

My blog

PHP Mortgage Calculator

Following last weeks release of a PHP Pagination Class to make pagination easier, today I'm releasing a simple, free, PHP Mortgage Calculator class. This is based off some work I did over a year ago, just cleaned up and polished for public consumption.

When this was used in a live site, it had been set to log all calculations a user made and gave them the option of sending this information to a mortgage advisor when they completed a contact form, so they could see the numbers they were looking at. This is why it isn't a JavaScript snippet (I'm planning on releasing one shortly).

Usage

<?php
require_once('mortgagecalculator.class.php');
$calc = new MortgageCalculator();
$calc->setAmountBorrowed( 125000 );
$calc->setInterestRate( 6 );
$calc->setYears( 25 );
echo 'Monthly repayment costs &pound;' . $calc->calculateRepayment();
echo 'Monthly interest-only costs &pound;' . $calc->calculateInterestOnlyPayment();
?>

Download

You can either download the class and supporting files as a zip, or view the code online.

Donate

Like this code, want to give me some pennies?

Posted by Michael on 20th Apr 2010 at 11:11

There are no comments on this post yet.

Add a comment