I am working on some financial calculators and although I succeeded to
created the required formulas I am not sure about the following.To give an
example: when somebody puts a capital on the bank with a yearly interest of
x % , the final capital after, say, 30 years can easily be calculated.
Since I want to be able to show the capital created after every year I
prefer to do it with a loop, something like
for($x= 1; $x < 30; $x++){
$capital = $capital*(1 + $interest /100)
} .
Another reason for such a loop is that the visitor could tell that he want
to withdraw some capital in the so-manieth year
Now let's say the visitor of the page can do a "quick scan" (just showing
the final amount) and request a table with all the yearly amounts
afterwards. In this case I will either have to store all the yearly capital
values into a an array and register that array to a session, or I will need
to do the whole loop again but this time something like
$capital = $capital*(1+ $interest/100);
echo "<tr><td>$capit al</td></tr>";
Although the formulas I "translated " from several excel sheets work fine, I
would like to know if storing such arrays could have negative consequences
for performance or memory on the server
Alternative suggestions, of course are also welcome. I tried to find similar
scripts on Google but I wasn't very successfull, probably because I am not
very familiar with the English financial terms
Thanks for any help.
Martien.
created the required formulas I am not sure about the following.To give an
example: when somebody puts a capital on the bank with a yearly interest of
x % , the final capital after, say, 30 years can easily be calculated.
Since I want to be able to show the capital created after every year I
prefer to do it with a loop, something like
for($x= 1; $x < 30; $x++){
$capital = $capital*(1 + $interest /100)
} .
Another reason for such a loop is that the visitor could tell that he want
to withdraw some capital in the so-manieth year
Now let's say the visitor of the page can do a "quick scan" (just showing
the final amount) and request a table with all the yearly amounts
afterwards. In this case I will either have to store all the yearly capital
values into a an array and register that array to a session, or I will need
to do the whole loop again but this time something like
$capital = $capital*(1+ $interest/100);
echo "<tr><td>$capit al</td></tr>";
Although the formulas I "translated " from several excel sheets work fine, I
would like to know if storing such arrays could have negative consequences
for performance or memory on the server
Alternative suggestions, of course are also welcome. I tried to find similar
scripts on Google but I wasn't very successfull, probably because I am not
very familiar with the English financial terms
Thanks for any help.
Martien.
Comment