bcscale(20);
$balance = 1;
-$years = 100;
-$rate = 0.02;
+$years = 2017;
+$rate = 0.03;
$totalMonths = $years * 12;
for ($i = 1; $i <= $totalMonths; $i++) {
// Reduce interest rate every month
- $rate = bcdiv($rate, 1.001);
+ $rate = bcdiv($rate, 1.00001);
// Calculate interest
$interest = bcmul($balance, $rate);
print 'After ' . $totalMonths . ' months (' . $years . ' years) you have ' . $balance . ' EUR back.' . PHP_EOL;
//print 'Length:' . strlen($balance) . PHP_EOL;
-
-?>