colombian Posted November 9, 2007 Share Posted November 9, 2007 I want to make a calculator that shows what your interest rate would be. The key is that it would output a new row per month with the interest charge, the next payment, etc. Not the single line, generic ones that are all over the web. Sample: User inputs: - Loan amount - Interest rate - minimum payment rate (usually between 1-3%) - monthly payment desired Here is the meat: The output would return anywhere from 1-400 rows, each explaining the current balance and the interest accrued for that month. I know the formula, I am having problems thinking this through... maybe I've had a long day at work, do send me your suggestions. Quote Link to comment Share on other sites More sharing options...
kratsg Posted November 9, 2007 Share Posted November 9, 2007 Ok, try it this way, imagine that you've got the formula, each row, you use this formula to calculate it for the month (all the data, I'm assuming is based on prior values and current time values). So try a while() loop: $current_balance = $initial_balance; while($i=0;$i<=$total_months;$++){//where $i is in months //use the formula to calculate the months //set $current_balance to whatever you got for this month, etc... so when it loops through again, it has last month's values echo "<tr><td>Hey look! I'm a row!</td></tr>"; } Hopefully, that might give you a big enough push? I'm not totally perfect on interest/economics stuff (I can define differential equations with it, but that's the extent of my abilities). Maybe you can define what values are needed for each month (generic, IE: previous month values, etc...) Quote Link to comment 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.