1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
$dureem = 240; // durée d'emprunt en mois
$tauxa = 5.20/100; // taux annuel
$tauxm = $tauxa/12; // taux périodique mensuel
$coef = 1+$tauxm;
$proposition_mensualites = 1500000*$tauxm*(pow($coef, $dureem)/(pow($coef, $dureem)-1)); // 1500000 est le capital emprunté
$proposition_mensualites += 750; // 750 correspondant à l'assurance
for($taux = 5.200; $taux <= 9.000; $taux += 0.001)
{
$total = 0;
for($nb_mois = 1; $nb_mois <= 240; $nb_mois++)
{
$total += ($proposition_mensualites/pow((1+($taux/100)),($nb_mois/12)));
}
if($total > (1500000-150) && $total < (1500000+150))
{
$teg = $taux;
break;
}
}
echo '<br>teg:'.$teg; |
Partager