Skip to content

Instantly share code, notes, and snippets.

@tuupola
Created April 21, 2020 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuupola/90a93d9b997d16d4e6de87ba3c1f94f8 to your computer and use it in GitHub Desktop.
Save tuupola/90a93d9b997d16d4e6de87ba3c1f94f8 to your computer and use it in GitHub Desktop.
<?php
function pmt($interest, $payments, $pv, $fc = 0.00, $type = 0)
{
$xp = pow((1 + $interest), $payments);
return
($pv * $interest * $xp / ($xp - 1) + $interest / ($xp - 1) * $fc) *
($type == 0 ? 1 : 1 / ($interest + 1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment