note 114376 added to numberformatter.formatcurrency
| From: | martintholzhauerdohdeu | Date: | Thu, 13 Feb 2014 14:37:23 +0000 |
| Subject: | note 114376 added to numberformatter.formatcurrency | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198498@lists.php.net to get a copy of this message | ||
When you want to format currency's without sub units and the currency is not the one used by
the given locale you need to set the currency code before as TextAttribute _BEFORE_ setting the
NumberFormatter::FRACTION_DIGITS
<?php
$fmt = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
$fmt->setTextAttribute(NumberFormatter::CURRENCY_CODE, 'EUR');
$fmt->setAttribute(NumberFormatter::FRACTION_DIGITS, 0);
$fmt->formatCurrency(100, 'EUR');
?>
----
Server IP: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/numberformatter.formatcurrency.php
Edit -- https://master.php.net/note/edit/114376
Del: integrated -- https://master.php.net/note/delete/114376/integrated
Del: useless -- https://master.php.net/note/delete/114376/useless
Del: bad code -- https://master.php.net/note/delete/114376/bad+code
Del: spam -- https://master.php.net/note/delete/114376/spam
Del: non-english -- https://master.php.net/note/delete/114376/non-english
Del: in docs -- https://master.php.net/note/delete/114376/in+docs
Del: other reasons-- https://master.php.net/note/delete/114376
Reject -- https://master.php.net/note/reject/114376
Search -- https://master.php.net/manage/user-notes.php