Jump to content

Showing a finance payment estimaton


DBookatay

Recommended Posts

I am attempting to add a estimated payment on my website, getting stuck on the interest amount.

Here's what I'd like to do:

 

(These will vary based on the year of the car, here for demonstration purposes)

 
$asking = 16495;
$down = 2474;
$doc = 200;
$interest = .05;
$tax = .0635;
$term = 60;

 

 

Basically what I'm trying to do is:

 

$asking  + $doc x $tax - $down x $interest / $term

 

In my finance calculator the payment comes out to $288.37.

On my site the payment is over $7000.

 

What am I not seeing?

Link to comment
https://forums.phpfreaks.com/topic/288748-showing-a-finance-payment-estimaton/
Share on other sites

Hard to say since you didn't post any code. But, the calculation you posted above is wrong for TWO reason:

 

1. You have to use parenthesis to ensure the calculations are completed in the order you expect. Otherwise the normal order of operations will take precedence. So, it would be calualted as follows:

$payment = $asking  + ($doc x $tax) - ($down x $interest / $term)

 

I think you want something like this

$payment = (((($asking  + $doc) x $tax) - $down) x $interest) / $term

 

However, that is also wrong. You cannot calculate interest across multiple multiple payments like that because the interest is not calculated up front. The interest is calculated each period. So, if the payments are monthly 1/12 of the interest is calculated against the remaining balance each month. The calculations uses some more advanced math. Go do a google search on calculating loan payments to get the correct formula

 

EDIT: Your signature also makes no sense

 

 

$result = mysql_query("SELECT finger FROM hand WHERE id=3"); 

echo $result;

 

What would be the significance of displaying your ring finger. I think you meant it to be the middle finger, in which case, it would be id = 2.

 

"There are 10 types of people in the world. Those who understand binary and those who don't"

 

$result = mysql_query("SELECT finger FROM hand WHERE id=3"); 

echo $result;

 

What would be the significance of displaying your ring finger. I think you meant it to be the middle finger, in which case, it would be id = 2.

 

"There are 10 types of people in the world. Those who understand binary and those who don't"

 

Psycho, you are making it too hard on him. Now he has to actually engage his brain. I sense an overuse of Tylenol is coming up.

 

Also he does not realize he actually selected all fingers from his 3rd hand...

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.