title: how to calculate excel pmt using php
body: <p>Have been trying to implement the pmt function used in excel into php. I have the formula but the calculations are showing incorrect.</p>
  
  <p>Its 6% interest rate for period of 30 years, final value being 833333.</p>
  
  <p>The right answer should be 10,541.</p>
  
  <p>payments are due at the end of the period so the type is zero and present value is zero.</p>
  
  <pre><code>&lt;pre&gt;
      $pv = 0;
      $fv = 833333;
      $i = 0.06/12;
      $n = 360;
  
      $pmt = (($pv - $fv) * $i )/ (1 - pow((1 + $i), (-$n))); 
  
      echo $pmt;
  &lt;/pre&gt;
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/5353511/pmt-in-javascript">Using this link as reference for formula</a></p>