private static function _aprAnnuity($pval, $months, $rate, $fee, $minpay)
    {
        $payment = self::_annuity($pval, $months, $rate) + $fee;
        if ($payment < 0) {
            return $payment;
        }
        $payarray = self::_fulpacc(
            $pval, $rate, $fee, $minpay, $payment, $months, false
        );
        $apr = self::_irr2apr(self::_irr($pval, $payarray, 1));

        return $apr;
    }
private static function _aprAnnuity($pval, $months, $rate, $fee, $minpay)
    {
        $payment = self::_annuity($pval, $months, $rate) + $fee;
        if ($payment < 0) {
            return $payment;
        }
        $payarray = self::_fulpacc(
            $pval, $rate, $fee, $minpay, $payment, $months, false
        );
        $apr = self::_irr2apr(self::_irr($pval, $payarray, 1));

        return $apr;
    }
private static function _aprAnnuity ( $ pval , $ months , $ rate , $ fee , $ minpay ) { $ payment = self :: _annuity ( $ pval , $ months , $ rate ) + $ fee ; if ( $ payment < 0 ) { return $ payment ; } $ payarray = self :: _fulpacc ( $ pval , $ rate , $ fee , $ minpay , $ payment , $ months , false ) ; $ apr = self :: _irr2apr ( self :: _irr ( $ pval , $ payarray , 1 ) ) ; return $ apr ; }
Calculate the APR for an annuity given the following inputs.

If you give it bad inputs, it will return negative values.

@param float $pval   principal value
@param int   $months months to pay off in
@param float $rate   interest rate in % as before
@param float $fee    monthly fee
@param float $minpay minimum payment per month

@return float APR in %
Calculate the APR for an annuity given the following inputs .