Skip to content

Commit

Permalink
Fix localized decimal parser documentation (#451)
Browse files Browse the repository at this point in the history
Fixes #450
  • Loading branch information
sagikazarmark authored and frederikbosch committed Feb 6, 2018
1 parent 3c3c2ab commit 106c66f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions doc/features/parsing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ correct subunit for the specific currency, you should also provide the specific

.. code-block:: php
use Money\Currency;
use Money\Currencies\ISOCurrencies;
use Money\Parser\IntlMoneyParser;
use Money\Parser\IntlLocalizedDecimalParser;
$currencies = new ISOCurrencies();
$numberFormatter = new \NumberFormatter('nl_NL', \NumberFormatter::DECIMAL);
$moneyParser = new IntlMoneyParser($numberFormatter, $currencies);
$moneyParser = new IntlLocalizedDecimalParser($numberFormatter, $currencies);
$money = $moneyParser->parse('1.000,00');
$money = $moneyParser->parse('1.000,00', new Currency('EUR'));
echo $money->getAmount(); // outputs 100000
Expand Down

0 comments on commit 106c66f

Please sign in to comment.