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: 161 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Periodic:: (3 methods):
  rate()
  modifiedRate()
  presentValue()


Class: Periodic  - X-Ref

rate($values, $guess = 0.1)   X-Ref
IRR.

Returns the internal rate of return for a series of cash flows represented by the numbers in values.
These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur
at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received
for an investment consisting of payments (negative values) and income (positive values) that occur at regular
periods.

Excel Function:
IRR(values[,guess])

param: mixed $values An array or a reference to cells that contain numbers for which you want
param: mixed $guess A number that you guess is close to the result of IRR
return: float|string

modifiedRate($values, $financeRate, $reinvestmentRate)   X-Ref
MIRR.

Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both
the cost of the investment and the interest received on reinvestment of cash.

Excel Function:
MIRR(values,finance_rate, reinvestment_rate)

param: mixed $values An array or a reference to cells that contain a series of payments and
param: mixed $financeRate The interest rate you pay on the money used in the cash flows
param: mixed $reinvestmentRate The interest rate you receive on the cash flows as you reinvest them
return: float|string Result, or a string containing an error

presentValue($rate, ...$args)   X-Ref
NPV.

Returns the Net Present Value of a cash flow series given a discount rate.

param: mixed $rate
return: float