adds another monetary object to the current one.
Parameters:
Money $money
- an amount or Money that will be added.
Returns: Money
MoneyHasDifferentCurrenciesException
- is thrown when a$money
argument has a different currency.
$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.