daniel-plewinski
8/18/2017 - 8:45 PM

Compound Interest / Procent składany

Compound Interest / Procent składany

function investment($amount, $percentage, $years) {
    $percentage /= 100;

    $profit = $amount * pow(1 + $percentage, $years) - $amount;
    $total = $amount + $profit;

    return $total;
}

echo investment(1000, 5, 1); // => 1050
echo "<br>";
echo investment(1000, 5, 2); // => 1102.5