Jump to content

Financial math


dreamwest

Recommended Posts

Im trying to get a monthly repayment for a loan but a $250,000 loan gives repayments of $136,250 per month

 

function _clean_number($input){
return (float) preg_replace('/[^0-9.]/', '', $input);
}

$id = 7.3; //interest rate
$amount = 250000; // amount of loan
$time = 30; //time in years

$month_term  = $time * 12;
$month_rate = $id / 12;
$power = -($month_term);
$denom = pow((1 + $month_rate), $power);
$amount = _clean_number($amount);

echo number_format($amount * ($month_rate / (1 - $denom)));

 

Link to comment
https://forums.phpfreaks.com/topic/214048-financial-math/
Share on other sites

Found the prob, i still needed to divide the int rate to a monthly amount:

function _clean_number($input){
return (float) preg_replace('/[^0-9.]/', '', $input);
}

$id = 7.3; //interest rate
$amount = 250000; // amount of loan
$time = 30; //time in years

$month_term  = $time * 12;
$month_rate = ($id / 100) / 12;
$power = -($month_term);
$denom = pow((1 + $month_rate), $power);
$amount = _clean_number($amount);

echo number_format($amount * ($month_rate / (1 - $denom)));

 

Link to comment
https://forums.phpfreaks.com/topic/214048-financial-math/#findComment-1113896
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.