PHP how to calculate the loan amount instead of the monthly installment?
<p>I calculated the monthly installment using this formula and it is working fine. How do I edit this formula and calculate the loan amount instead? In this case the loan amount is $balance.</p>

<p>Monthly Installment is $64,366.6667</p>

<p>Interest Rate is 2%</p>

<p>Loan Tenure is 35years</p>

<p>Mortgage Calculator Formula:</p>

<pre><code>$period = 12; 

function calculateMortgage($balance,$rate,$term){
   global $period; 

   $N = $term * $period; 
   $I = ($rate/100)/$period;
   $v = pow((1+$I),$N);
   $t = ($I*$v)/($v-1);
   $result = $balance*$t;

   return $result;
}
</code></pre>
