コード例 #1
0
function berekenRente($startGeld)
{
    static $aantalJaar = 1;
    if ($aantalJaar <= 10) {
        $geld = floor($startGeld * 1.08);
        echo "<p>Geld na " . $aantalJaar . " jaar is " . $geld . "</p>";
        $aantalJaar++;
        berekenRente($geld);
    }
}
コード例 #2
0
function berekenRente($rente, $duur, $jaren)
{
    if (is_array($jaren) && !empty($jaren)) {
        // jaren is an array & not empty
        $laatsteJaar = max(array_keys($jaren));
        if ($laatsteJaar < $duur) {
            $jaren[] = round($jaren[$laatsteJaar] * ($rente + 1), 2);
            return berekenRente($rente, $duur, $jaren);
        } else {
            return $jaren;
        }
    }
}
function berekenRente($bedrag, $renteVoet, $aantalJaren)
{
    static $counter = 0;
    static $arrayGetallen = array();
    if ($counter <= $aantalJaren) {
        $rente = floor($renteVoet / 100 * $bedrag);
        $nieuwBedrag = $rente + $bedrag;
        $arrayGetallen[$counter] = "Het nieuwe bedrag is " . $nieuwBedrag;
        $counter++;
        return berekenRente($nieuwBedrag, $renteVoet, $aantalJaren);
    } else {
        return $arrayGetallen;
    }
}