Skip to content

Instantly share code, notes, and snippets.

@ramcoelho
Created August 6, 2019 15:58
Show Gist options
  • Save ramcoelho/8b7ffcd9bc957144d762ce34f9f137d8 to your computer and use it in GitHub Desktop.
Save ramcoelho/8b7ffcd9bc957144d762ce34f9f137d8 to your computer and use it in GitHub Desktop.
Cálculo de juros com aportes regulares
<?php
// Configuração
$taxa = 1.01; // 1% ao período
$períodos = 10;
$aporte = 100; // Aporte por período
// Cálculo
$acumulado = 0;
while ($periodos-- > 0) {
$acumulado++;
$acumulado *= $taxa;
}
$saldo = $acumulado * $aporte;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment