rtefamily asked:
I’m making an online version of a bank, for a game. Is there a way to have a program compound interest every day, or make a program that executes itself once per day, even when I’m not there to run it? I can use PHP and MySQL, and I also have Perl.
I’m making an online version of a bank, for a game. Is there a way to have a program compound interest every day, or make a program that executes itself once per day, even when I’m not there to run it? I can use PHP and MySQL, and I also have Perl.


2 Comments to 'How could I make an online version of a bank with daily-compounded interest with PHP, MySQL, and Perl?'
February 16, 2009
Assuming you’re on *nix. Type ‘man crontab’ and ‘man 5 crontab’. On most systems cron is a program that runs commands at specified times. If you’re on Windows the windows scheduler (control panel->scheduled tasks) will do the same thing.
*nix example from man page:
# run five minutes after midnight, every day
5 0 * * * /usr/bin/php $HOME/bin/daily.php >> $HOME/tmp/out 2>&1
February 17, 2009
You can use the compound interest equation.
A = P * (1 + (i / q))^(n * q)
A = Total Amount
P = Initial amount in bank
i = annual interest rate (in decimal; if 10%, i=0.10)
q = number of compounds per year (if compounded monthly, q=12. if compounded daily, q=365)
n = number of years (can be less than 1)
Leave a comment