debx (); functiondebx () {$dkm= 240;//month of loan, 20 is 240 months $dkTotal= 10000;//Total Loans $DKNL= 0.0515;//Loan Annual interest rate $emTotal=$dkTotal*$DKNL/12 *POW(1 +$DKNL/12,$dkm) / (POW(1 +$DKNL/12,$dkm)-1);//Monthly repayment Amount $lxTotal= 0;//Total Interest for($i= 0;$i<$dkm;$i++) { $LX=$dkTotal*$DKNL/12;//Monthly repayment Interest $em=$emTotal-$LX;//Monthly Repayment principal Echo"section". ($i+ 1). "Period", "Principal:",$em, "Interest:".$LX, "Total:".$emTotal, "<br/>"; $dkTotal=$dkTotal-$em; $lxTotal=$lxTotal+$LX; } Echo"Total interest:".$lxTotal; } functiondebj () {$dkm= 240;//month of loan, 20 is 240 months $dkTotal= 10000;//Total Loans $DKNL= 0.0515;//Loan Annual interest rate $em=$dkTotal/$dkm;//repayment principal per month $lxTotal= 0;//Total Interest for($i= 0;$i<$dkm;$i++) { $LX=$dkTotal*$DKNL/12;//Monthly repayment Interest Echo"section". ($i+ 1). "Period", "Principal:",$em, "Interest:".$LX, "Total:". ($em+$LX), "<br/>"; $dkTotal-=$em; $lxTotal=$lxTotal+$LX; } Echo"Total interest:".$lxTotal; } Exit;
PHP Mortgage Calculator Code, equal and principal, equal to the principal