English 中文(简体)
PHP 加拿大按揭抵押计算计算器
原标题:PHP Mortgage Calculator Canada

我刚找到一个按揭计算器功能

function calculatePayment($price, $down, $term)
{
$loan = $price - $down;
$rate = (2.5/100) / 12;
$month = $term * 12;
$payment = floor(($loan*$rate/(1-pow(1+$rate,(-1*$month))))*100)/100;
return $payment;
}

因此,如果我这样做:

calculatePayment(200000,0,25)

897.23美元还我897.23美元。

问题是,如果我和BMO Bank 或 duroto.com com 计算器相比, 我的功能似乎不象其他两个网站一样有效, 结果为895,93美元。

有人能帮我弄清楚 为什么它不归还那笔钱吗?

非常感谢

问题回答

我已将的平衡计算部分转换为PHP函数(同样添加了首付变量),并给出了一个使用实例:http://www.secureapp.com/tools/mortgage.html

$principal = 684000; //Mortgage Amount 
$interest_rate = 2.89; //Interest Rate %
$down = $principal *0.10; //10% down payment
$years = 25;
$months = 0;
$compound = 2; //compound is always set to 2
$frequency = 12; //Number of months (Monthly (12), Semi-Monthly (24), Bi-Weekly(26) and Weekly(52) 

function calcPay($MORTGAGE, $AMORTYEARS, $AMORTMONTHS, $INRATE, $COMPOUND, $FREQ, $DOWN){
$MORTGAGE = $MORTGAGE - $DOWN;
$compound = $COMPOUND/12;
$monTime = ($AMORTYEARS * 12) + (1 * $AMORTMONTHS);
$RATE = ($INRATE*1.0)/100;
$yrRate = $RATE/$COMPOUND;
$rdefine = pow((1.0 + $yrRate),$compound)-1.0;
$PAYMENT = ($MORTGAGE*$rdefine * (pow((1.0 + $rdefine),$monTime))) / ((pow((1.0 + $rdefine),$monTime)) - 1.0);
if($FREQ==12){
    return $PAYMENT;}
if($FREQ==26){
    return $PAYMENT/2.0;}
if($FREQ==52){
    return $PAYMENT/4.0;}
if($FREQ==24){
    $compound2 = $COMPOUND/$FREQ;
    $monTime2 = ($AMORTYEARS * $FREQ) + ($AMORTMONTHS * 2);
    $rdefine2 = pow((1.0 + $yrRate),$compound2)-1.0;
    $PAYMENT2 = ($MORTGAGE*$rdefine2 * (pow((1.0 + $rdefine2),$monTime2)))/  ((pow((1.0 + $rdefine2),$monTime2)) - 1.0);
    return $PAYMENT2;
}
}

$payment = calcPay($principal, $years, $months, $interest_rate, $compound, $frequency, $down);

而不是每月复数,而是每6个月对抵押贷款进行 < 坚固 > 计算。

加拿大的抵押贷款每6个月一次,而不是每月一次。

除了可变利率按揭之外,所有按揭都依法每半年复加一次。 因此, 如果按揭的利率为6%, 则按揭的实际年利率为6. 09%, 以每半年3%为基础。 但是, 你每月支付利息, 所以按揭贷款人需要使用基于年利率低于6%的月利率。 为什么? 因为按揭利率会每月复加一次。 因此, 我们需要找到每月复加的利率, 实际年利率为6. 09%。 从数学角度讲, 这将是:

(1+rM)12-1 = 0.0609

rM = (1.0609)1/12

rM = 0.493862...%

资料来源:http://www.yorku.ca/amarshal/mortgage.htm

您的计算是可以的 - 您的按揭计算器 : http://aprc.eu/index.php? page=APR-loan-caulator

您的结果和引用的银行加热器差异来自不同的假设。 您使用的公式是月末 < / 加热量 > 每月支付 < 坚固度 > 。 如果在月份开始 < / 加热量 > 时支付 " 坚固度 ", 溢出量则较低, 支付量也可能较低 。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签