Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
c3de57d
commit 5a7dc2c
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
.. _aggregation: | ||
|
||
Aggregation | ||
=========== | ||
|
||
``min()`` returns the smallest of the given Money objects | ||
|
||
.. code-block:: php | ||
$first = Money::EUR(100); // €1.00 | ||
$second = Money::EUR(200); // €2.00 | ||
$third = Money::EUR(300); // €3.00 | ||
$min = Money::min($first, $second, $third) // €1.00 | ||
``max()`` returns the largest of the given Money objects | ||
|
||
.. code-block:: php | ||
$first = Money::EUR(100); // €1.00 | ||
$second = Money::EUR(200); // €2.00 | ||
$third = Money::EUR(300); // €3.00 | ||
$max = Money::max($first, $second, $third) // €3.00 | ||
``avg()`` returns the average value of the given Money objects as a Money object | ||
|
||
.. code-block:: php | ||
$first = Money::EUR(100); // €1.00 | ||
$second = Money::EUR(-200); // -€2.00 | ||
$third = Money::EUR(300); // €3.00 | ||
$avg = Money::avg($first, $second, $third) // €2.00 | ||
``sum()`` provides the sum of all given Money objects | ||
|
||
.. code-block:: php | ||
$first = Money::EUR(100); // €1.00 | ||
$second = Money::EUR(-200); // -€2.00 | ||
$third = Money::EUR(300); // €3.00 | ||
$sum = Money::sum($first, $second, $third) // €2.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters