PHP房贷计算器代码,等额本息,等额本⾦    debx();
function debx()
{
$dkm    = 240; //贷款⽉数,20年就是240个⽉
$dkTotal = 10000; //贷款总额
$dknl    = 0.0515;  //贷款年利率
$emTotal = $dkTotal * $dknl / 12 * pow(1 + $dknl / 12, $dkm) / (pow(1 + $dknl / 12, $dkm) - 1); //每⽉还款⾦额
$lxTotal = 0; //总利息
for ($i = 0; $i < $dkm; $i++) {
$lx      = $dkTotal * $dknl / 12;  //每⽉还款利息
$em      = $emTotal - $lx;  //每⽉还款本⾦
echo "第" . ($i + 1) . "期", " 本⾦:", $em, " 利息:" . $lx, " 总额:" . $emTotal, "<br />";
$dkTotal = $dkTotal - $em;
$lxTotal = $lxTotal + $lx;
}
echo "总利息:" . $lxTotal;
}
function debj()
{
$dkm    = 240; //贷款⽉数,20年就是240个⽉
$dkTotal = 10000; //贷款总额
$dknl    = 0.0515;  //贷款年利率
$em      = $dkTotal / $dkm; //每个⽉还款本⾦
$lxTotal = 0; //总利息
for ($i = 0; $i < $dkm; $i++) {
$lx      = $dkTotal * $dknl / 12; //每⽉还款利息
echo "第" . ($i + 1) . "期", " 本⾦:", $em, " 利息:" . $lx, " 总额:" . ($em + $lx), "<br />";
$dkTotal -= $em;
php实例计算器教程$lxTotal = $lxTotal + $lx;
}
echo "总利息:" . $lxTotal;
}
exit;

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。