DBookatay Posted May 24, 2014 Share Posted May 24, 2014 (edited) 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? Edited May 24, 2014 by DBookatay Quote Link to comment https://forums.phpfreaks.com/topic/288748-showing-a-finance-payment-estimaton/ Share on other sites More sharing options...
Psycho Posted May 25, 2014 Share Posted May 25, 2014 (edited) 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" Edited May 25, 2014 by Psycho Quote Link to comment https://forums.phpfreaks.com/topic/288748-showing-a-finance-payment-estimaton/#findComment-1480753 Share on other sites More sharing options...
ignace Posted May 25, 2014 Share Posted May 25, 2014 (edited) $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... Edited May 25, 2014 by ignace Quote Link to comment https://forums.phpfreaks.com/topic/288748-showing-a-finance-payment-estimaton/#findComment-1480771 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.