/** * Returns the principal payment for a given period for a cash flow with constant periodic payments (annuities) * and interest rate * Excel equivalent: PPMT * * @param float Interest rate per period * @param int Period for which the principal payment will be calculated * @param int Number of periods * @param float Present Value * @param float Future Value * @param int Payment type: FINANCE_PAY_END (default): at the end of each period FINANCE_PAY_BEGIN: at the beginning of each period * @return float * @static * @access public */ function principalPayment($rate, $per, $nper, $pv, $fv = 0, $type = 0) { if ($type != FINANCE_PAY_END && $type != FINANCE_PAY_BEGIN) { return PEAR::raiseError('Payment type must be FINANCE_PAY_END or FINANCE_PAY_BEGIN'); } $interestAndPrincipal = Math_Finance::_interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type); return $interestAndPrincipal[1]; }