" method="post">
Rent Assumptions
Monthly rent payment *
Additional monthly fees
Monthly renter's insurance premium
Annual rent increase (0-10)%
Purchase Assumptions
Property value *
Annual appriciation rate * (0-10)%
Loan Amount *
Annual interest rate * (0-30)%
Amortization length * (1-30) years
Annual homeowner's insurance premium
Annual property taxes
Annual maintenance cost
Other assumptions
Number of Years for the Comparision * (1-30) years
Marginal tax bracket (0-50)%
Before tax return on savings (0-12)%
Assumed annual inflation rate (0-10)%

* required information

10) $error[] = "Please make sure that the Annual rent increase is between 0 to 10%."; elseif($_POST[pvIncrease]>10) $error[] = "Please make sure that the Annual appriciation rate is between 0 to 10%."; elseif((intval($_POST[interestRate]) > 30) || (intval($_POST[interestRate]) < 1)) $error[] = "Please make sure that the Annual interest rate is between 0 to 30."; elseif((intval($_POST[mYears]) > 30) || (intval($_POST[mYears]) < 1)) $error[] = "Please make sure that the Amortization length is between 1 to 30."; elseif((intval($_POST[cYears]) > 30) || (intval($_POST[cYears]) < 1)) $error[] = "Please make sure that the Number years for the comparison is between 1 to 30."; elseif($_POST[taxBracket]>50) $error[] = "Please check Marginal tax bracket field."; elseif($_POST[taxSavings]>12) $error[] = "Please check Before tax return on savings field."; elseif($_POST[inflation]>10) $error[] = "Please check Assumed annual inflation rate field."; if(count($error)) { echo '
'; } $error = ob_get_clean(); //var_dump($error); if(empty($error)) { ob_start(); $N = 12*$_POST[mYears]; $r = $_POST[interestRate]/100/12; $R = 1+$r; $monthlyPayment = $_POST[loanAmount]*$r / (1 - pow((1+$r),(-$N))); $taxRate = $_POST[pTax] * 100/$_POST[pValue]; $insuranceRate = $_POST[insurance]*100/$_POST[pValue]; echo ""; echo ""; for($yr=1; $yr<=$_POST[cYears]; $yr++) { //---Rent Calculations $incr = $incr + ($rentPerYear*$_POST[rIncrease]/100); $rentPerYear = ($_POST[rPayment]+ $_POST[aFees]+$_POST[rInsurance])*12 + $incr; $totalRent = $totalRent + $rentPerYear; //---Appriciation if($yr == 1) $appriciation = $_POST[pValue]*(($_POST[pvIncrease]/100)); else $appriciation = $property*(($_POST[pvIncrease]/100)); $appriciationTotal = $appriciation + $appriciationTotal; $property = $appriciationTotal + $_POST[pValue]; //---Purchase Calculations //---Mortgage Calculation $t = (12*$yr); $balance = ($_POST[loanAmount]*pow($R,$t)) - $monthlyPayment*(pow($R,$t)-1)/($R-1); $balanceB = ($_POST[loanAmount]*pow($R,($t-12))) - $monthlyPayment*(pow($R,($t-12))-1)/($R-1); if($yr == 1) $interest_paid = $monthlyPayment*12 - ($_POST[loanAmount] - $balance); else $interest_paid = $monthlyPayment*12 - ($balanceB - $balance); //---Insurance Taxes & Maintenance if($yr == 1) $insurance = $_POST[insurance]; else $insurance = $property * $insuranceRate/100; $insuranceTotal = $insuranceTotal + $insurance; if($yr == 1) $tax = $_POST[pTax]; else $tax = $property * $taxRate/100; $taxTotal = $taxTotal + $tax; $maintenance = $_POST[maintenance]; $maintenanceTotal = $maintenanceTotal + $maintenance; //---Tax Savings $taxSavings = ((($interest_paid) * ($_POST[taxBracket]/100)) + ($maintenance * $_POST[taxBracket]/100)); $taxSavingsTotal = $taxSavingsTotal + $taxSavings; $itm = $insurance + $tax + $maintenance; $oppertunity = (((($property - $_POST[loanAmount])*$_POST[taxSavings]/100))*(1 - $_POST[taxBracket]/100)); $oppertunityTotal = $oppertunityTotal + $oppertunity; $costfBuying = $monthlyPayment*12 + $itm + $oppertunity - $taxSavings - $appriciation; echo ""; } echo "
YearRent & FeesMortgage PaymentInsurance, Taxes & MaintenanceOppertunity CostTax SavingsAppriciationCost of Buying
$yr".number_format($rentPerYear,2)."".number_format(($monthlyPayment*12),2)."".number_format($itm,2)."".number_format($oppertunity,2)."".number_format($taxSavings)."".number_format($appriciation,2)."".number_format($costfBuying,2)."

"; if(!empty($_POST[cYears])) $avgMonthlyRent = $totalRent/(12*$_POST[cYears]); $mortgagePayments = $monthlyPayment * 12 * $_POST[cYears]; $totalPurchase = $mortgagePayments + $insuranceTotal + $taxTotal + $maintenanceTotal + $oppertunityTotal - $taxSavingsTotal - $appriciationTotal; $totalPurchase_in = ($totalPurchase * (1 - ($_POST[inflation]/100))); $totalRent_in = ($totalRent * (1 - ($_POST[inflation]/100))); $result = ob_get_clean(); } } ?> Results"; ?> $totalPurchase_in) { echo ""; } elseif($totalRent_in < $totalPurchase_in) { echo ""; } echo "
Rent vs. Buy Analysis Rent Buy
Rent and fees
Mortgage payments   +
Property insurance   +
Property taxes   +
Property maintenance   +
Opportunity cost   +
Tax Savings   -
Appriciation   -
Total Payment
Present value at inflation
Total Savings on Buying: $" . number_format(($totalRent_in - $totalPurchase_in),2) . "
TOtal Savings on Rent: $" . number_format(($totalPurchase_in - $totalRent_in),2) . "

"; $summary = ob_get_clean(); } if(empty($_POST[action])) echo "$form"; else { echo "$error"; echo "$summary"; echo "$result"; echo "$form"; } ?>