Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 683 Bytes

add.md

File metadata and controls

30 lines (19 loc) · 683 Bytes

add()

adds another monetary object to the current one.

Methods

add(Money $money)

Parameters:

  1. Money $money - an amount or Money that will be added.

Returns: Money

Exceptions

  1. MoneyHasDifferentCurrenciesException - is thrown when a $money argument has a different currency.

Usage

$m1 = money('1000000');                 // "$ 100"
$m2 = money('500000');                  // "$ 50"
$m3 = money('500000', currency('RUB')); // "50 ₽"

$m1->add($m2);                          // "$ 150"
$m1->add($m3);                          // MoneyHasDifferentCurrenciesException

📌 Back to the contents.