subtracts another monetary object from the current one.
Parameters:
Money $money
- Money that will be subtracted.
Returns: Money
MoneyHasDifferentCurrenciesException
- is thrown when a$money
argument has a different currency.
$m1 = money('1500000'); // "$ 150"
$m2 = money('500000'); // "$ 50"
$m3 = money('500000', currency('RUB')); // "50 ₽"
$m1->subtract($m2); // "$ 100"
$m1->subtract($m3); // MoneyHasDifferentCurrenciesException
📌 Back to the contents.