+<?php
+error_reporting(E_ALL | E_STRICT);
+
+bcscale(20);
+
+$balance = 1;
+$years = 100;
+$rate = 0.05;
+
+$totalMonths = $years * 12;
+
+print 'Invest ' . $balance . ' EUR and come back later.' . PHP_EOL;
+
+for ($i = 1; $i <= $totalMonths; $i++) {
+ if ($i % 12 == 0) {
+ $rate = bcdiv($rate, 1.01);
+ } // END - if
+
+ $interest = bcmul($balance, $rate);
+ $balance = bcadd($balance, $interest);
+
+ print 'Month ' . $i . ': rate=' . bcmul($rate, 100) . '%,interest=' . $interest . ',balance=' . $balance . PHP_EOL;
+} // END - foreach
+
+print 'After ' . $totalMonths . ' months (' . $years . ' years) you have ' . $balance . ' EUR back.' . PHP_EOL;
+//print 'Length:' . strlen($balance) . PHP_EOL;
+
+?>