Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 217 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Interest:: (4 methods):
  payment()
  schedulePayment()
  rate()
  rateNextGuess()


Class: Interest  - X-Ref

payment($interestRate,$period,$numberOfPeriods,$presentValue,$futureValue = 0,$type = FinancialConstants::PAYMENT_END_OF_PERIOD)   X-Ref
IPMT.

Returns the interest payment for a given period for an investment based on periodic, constant payments
and a constant interest rate.

Excel Function:
IPMT(rate,per,nper,pv[,fv][,type])

param: mixed $interestRate Interest rate per period
param: mixed $period Period for which we want to find the interest
param: mixed $numberOfPeriods Number of periods
param: mixed $presentValue Present Value
param: mixed $futureValue Future Value
param: mixed $type Payment type: 0 = at the end of each period, 1 = at the beginning of each period
return: float|string

schedulePayment($interestRate, $period, $numberOfPeriods, $principleRemaining)   X-Ref
ISPMT.

Returns the interest payment for an investment based on an interest rate and a constant payment schedule.

Excel Function:
=ISPMT(interest_rate, period, number_payments, pv)

param: mixed $interestRate is the interest rate for the investment
param: mixed $period is the period to calculate the interest rate.  It must be betweeen 1 and number_payments.
param: mixed $numberOfPeriods is the number of payments for the annuity
param: mixed $principleRemaining is the loan amount or present value of the payments

rate($numberOfPeriods,$payment,$presentValue,$futureValue = 0.0,$type = FinancialConstants::PAYMENT_END_OF_PERIOD,$guess = 0.1)   X-Ref
RATE.

Returns the interest rate per period of an annuity.
RATE is calculated by iteration and can have zero or more solutions.
If the successive results of RATE do not converge to within 0.0000001 after 20 iterations,
RATE returns the #NUM! error value.

Excel Function:
RATE(nper,pmt,pv[,fv[,type[,guess]]])

param: mixed $numberOfPeriods The total number of payment periods in an annuity
param: mixed $payment The payment made each period and cannot change over the life of the annuity.
param: mixed $presentValue The present value - the total amount that a series of future payments is worth now
param: mixed $futureValue The future value, or a cash balance you want to attain after the last payment is made.
param: mixed $type A number 0 or 1 and indicates when payments are due:
param: mixed $guess Your guess for what the rate will be.
return: float|string

rateNextGuess($rate, $numberOfPeriods, $payment, $presentValue, $futureValue, $type)   X-Ref
No description