📄 02c04-2.php
字号:
<?php// Calculating Compound Interest:// a = the initial amount you are calculating from// r = the annual percentage rate// f = the frequency (per year) of compounding// y = the number of years you wish to calculate this for:function calc_compound_interest($a, $r, $f, $y) { return $a * pow((1 + ($r / $f)), ($f * $y));}// Calculate the value of $5000, at 3.25% interest, // compounded daily, for 3 years. Answer: 5512.0332828079echo calc_compound_interest(5000, .0325, 365, 3), '<br />';// Calculate the value of $1000, at 8.5% interest, // compounded monthly, for 6 months. Answer: 1043.2597499629echo calc_compound_interest(1000, .085, 12, .5);?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -