Online Mortgage Calculator
");
print(" Mortgage Calculator");
print("");
print("PHP Mortgage Calculator");
print(" \n\n");
$print_footer = TRUE;
} else {
$print_footer = FALSE;
}
// Style Sheet
?>
Sale Price of Home, Length of Motgage and Annual Interest Rate";
}
if (!$error) {
$month_term = $year_term * 12;
$down_payment = $sale_price * ($down_percent / 100);
$annual_interest_rate = $annual_interest_percent / 100;
$monthly_interest_rate = $annual_interest_rate / 12;
$financing_price = $sale_price  $down_payment;
$monthly_factor = get_interest_factor($year_term, $monthly_interest_rate);
$monthly_payment = $financing_price / $monthly_factor;
}
} else {
if (!$sale_price) { $sale_price = $default_sale_price; }
if (!$annual_interest_percent) { $annual_interest_percent = $default_annual_interest_percent; }
if (!$year_term) { $year_term = $default_year_term; }
if (!$down_percent) { $down_percent = $default_down_percent; }
if (!$show_progress) { $show_progress = $default_show_progress; }
}
if ($error) {
print("" . $error . "
\n");
$form_complete = false;
}
?>
This
mortgage calculator can be used to figure out monthly payments
of a home mortgage loan, based on the home's sale price, the
term of the loan desired, buyer's down payment percentage,
and the loan's interest rate. This calculator factors in PMI
(Private Mortgage Insurance) for loans where less than 20%
is put as a down payment. You will need to take into consideration
the addition of real estate taxes and home owners insurance
to determine total monthly carrying charges.
Amortization For Monthly Payment: \$" . number_format($monthly_payment, "2", ".", "thousands_sep") . " over " . $year_term . " years \n");
print("\n");
// This LEGEND will get reprinted every 12 months
$legend = "\t\n";
$legend .= "\t\t\n";
$legend .= "\t\t\n";
$legend .= "\t\t\n";
$legend .= "\t\t\n";
$legend .= "\t\n";
echo $legend;
// Loop through and get the current month's payments for
// the length of the loan
while ($current_month <= $month_term) {
$interest_paid = $principal * $monthly_interest_rate;
$principal_paid = $monthly_payment  $interest_paid;
$remaining_balance = $principal  $principal_paid;
$this_year_interest_paid = $this_year_interest_paid + $interest_paid;
$this_year_principal_paid = $this_year_principal_paid + $principal_paid;
print("\t\n");
print("\t\t\n");
print("\t\t\n");
print("\t\t\n");
print("\t\t\n");
print("\t\n");
($current_month % 12) ? $show_legend = FALSE : $show_legend = TRUE;
if ($show_legend) {
print("\t\n");
print("\t\t\n");
print("\t\n");
$total_spent_this_year = $this_year_interest_paid + $this_year_principal_paid;
print("\t\n");
print("\t\t\n");
print("\t\t\n");
print("\t\n");
print("\t\n");
print("\t\t\n");
print("\t\n");
$current_year++;
$this_year_interest_paid = 0;
$this_year_principal_paid = 0;
if (($current_month + 6) < $month_term) {
echo $legend;
}
}
$principal = $remaining_balance;
$current_month++;
}
print("Month  Interest Paid  Principal Paid  Remaing Balance  " . $current_month . "  \$" . number_format($interest_paid, "2", ".", "thousands_sep") . "  \$" . number_format($principal_paid, "2", ".", "thousands_sep") . "  \$" . number_format($remaining_balance, "2", ".", "thousands_sep") . "  Totals for year " . $current_year . "   \n");
print("\t\t\tYou will spend \$" . number_format($total_spent_this_year, "2", ".", "thousands_sep") . " on your house in year " . $current_year . " \n");
print("\t\t\t\$" . number_format($this_year_interest_paid, "2", ".", "thousands_sep") . " will go towards INTEREST \n");
print("\t\t\t\$" . number_format($this_year_principal_paid, "2", ".", "thousands_sep") . " will go towards PRINCIPAL \n");
print("\t\t 
 \n");
}
?>
\n");
print("
\n");
}
?>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of David Tufts nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
?>
