So I'm creating this php local site for my work it is about mortgage and I made this code as a begging
<?php
$income=1650;
$rate=7;
$period=240;
$graduation =60;
$paytoinc=40;
$rowage=7;
for ($l=1; $l <= $period ; $l++) {
for ($i=1; $i <= $graduation ; $i=+12) {
$NPV = (1/pow(1+($rate/100)/12, $i));
$income = $income*(1+($rowage/100));
$mpayment = $income *$paytoinc/100 ;
}
echo $mpayment = $income *$paytoinc/100 ;
}
?>
I have 2 periods , 1 is included in the other for some reason this is making endless loop , I'm new so can anyone tell me what am I missing and doing wrong ?
$mpaymenton each iteration of the inner loop but only using the final value that you calculate in the last line of your outer loop. You could remove this line from the inner loop to increase efficiency.