<?php
/**
* @desc Calculates the monthly payments of a loan
* based on the APR and Term.
*
* @param Float $fLoanAmount The loan amount.
* @param Float $fAPR The annual interest rate.
* @param Integer $iTerm The length of the loan in months.
* @return Float Monthly Payment.
*/
function calculateMonthlyPayments( $fLoanAmount , $fAPR, $iTerm )
{
return ($fLoanAmount/$iTerm)+(($fLoanAmount/$iTerm)/100*($fAPR/12*$iTerm));
}
echo calculateMonthlyPayments( 100, 8.9, 12 );
?>

The formula you gave doesn’t seem to work too well. On a loan of $60,000.00 at 9% for 30 years (360 payments), this formula gives a monthly payment of $616.67, but the actual monthly payment on that loan would be $482.77.

The loan amount ($amt) is in dollars, interest rate ($i) is in whole numbers (9 for 9% not .09) and the term of the loan ($term) is in months. You’ll have to do the formatting of the output. I checked the formula in as written here with the values that I provided and it gives the right payment: $482.77.

I’ve look for a good payment solution and this is simple and elegant, congratulations. I haven’t tried it out yet, but it looks right. Typically the payment would be a neg number where this would appear to provide a positive number, but most expect a positive number anyway so I don’t have to do a neg ot pos fix.