Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 692 Bytes

subtract.md

File metadata and controls

30 lines (19 loc) · 692 Bytes

subtract()

subtracts another monetary object from the current one.

Methods

subtract(Money $money)

Parameters:

  1. Money $money - Money that will be subtracted.

Returns: Money

Exceptions

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

Usage

$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.