Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 725 Bytes

rebase.md

File metadata and controls

30 lines (19 loc) · 725 Bytes

rebase()

rebases the current monetary object on another money's amount.

Methods

rebase(Money $money)

Parameters:

  1. Money $money - A monetary object to which the current money will be rebased.

Returns: Money

Exceptions

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

Usage

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

$m1->rebase($m2);                       // "$ 75"
$m1->rebase($m3);                       // MoneyHasDifferentCurrenciesException

📌 Back to the contents.