Continued:
[core.git] / contrib / exp / exp2.php
index b6040fc543f68f9407f21e13844cac84ae30bb27..d83a33c6bc12dc9ac0317e03c323ceb7339d54f9 100644 (file)
@@ -4,8 +4,8 @@ error_reporting(E_ALL | E_STRICT);
 bcscale(20);
 
 $balance = 1;
-$years = 100;
-$rate = 0.02;
+$years = 2017;
+$rate = 0.03;
 
 $totalMonths = $years * 12;
 
@@ -13,7 +13,7 @@ print 'Invest ' . $balance . ' EUR and come back later.' . PHP_EOL;
 
 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);
@@ -26,5 +26,3 @@ for ($i = 1; $i <= $totalMonths; $i++) {
 
 print 'After ' . $totalMonths . ' months (' . $years . ' years) you have ' . $balance . ' EUR back.' . PHP_EOL;
 //print 'Length:' . strlen($balance) . PHP_EOL;
-
-?>