Excel PMT in PHP (cleaner)

There are a couple versions of this floating around, but all with very obscure variable names and/or requiring to put math inside the function call line like:

<?php
$mortgage
= number_format(PMT(2.1 / 1200, 360, -100000),2);
?>

Which looks horrible (not to mention you have to put loan amount in as negative number).
With this, your line will look like:

<?php
$mortgage
= pmt(2.1, 30, 100000);
?>

Here it is:

<?php
/**
 * PHP Version of PMT in Excel.
 *
 * @param float $apr
 *   Interest rate.
 * @param integer $term
 *   Loan length in years.
 * @param float $loan
 *   The loan amount.
 *
 * @return float
 *   The monthly mortgage amount.
 */
function pmt($apr, $term, $loan) {
 
$term = $term * 12;
 
$apr = $apr / 1200;
 
$amount = $apr * -$loan * pow((1 + $apr), $term) / (1 - pow((1 + $apr), $term));
  return
number_format($amount, 2);
}
?>
Joshua Walker