note 117214 added to numberformatter.formatcurrency
| From: | idragosalex | Date: | Mon, 04 May 2015 11:58:15 +0000 |
| Subject: | note 117214 added to numberformatter.formatcurrency | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202421@lists.php.net to get a copy of this message | ||
It seams that for currency symbols that contain the dollar sign '$' the resulting
formatted number is broken: 95.23 is formatted .23 instead of $95.23. As a workaround, you need to
modify the pattern by adding a space:
<?php
$fmt = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
$fmt->setTextAttribute(NumberFormatter::CURRENCY_CODE, 'CAD');
$fmt->setPattern( str_replace('¤#','¤ #', $fmt->getPattern() ) );
echo $fmt->formatCurrency(100, 'CAD');
?>
----
Server IP: 72.52.91.14
Probable Submitter: 188.24.139.57
----
Manual Page -- http://php.net/manual/en/numberformatter.formatcurrency.php
Edit -- https://master.php.net/note/edit/117214
Del: integrated -- https://master.php.net/note/delete/117214/integrated
Del: useless -- https://master.php.net/note/delete/117214/useless
Del: bad code -- https://master.php.net/note/delete/117214/bad+code
Del: spam -- https://master.php.net/note/delete/117214/spam
Del: non-english -- https://master.php.net/note/delete/117214/non-english
Del: in docs -- https://master.php.net/note/delete/117214/in+docs
Del: other reasons-- https://master.php.net/note/delete/117214
Reject -- https://master.php.net/note/reject/117214
Search -- https://master.php.net/manage/user-notes.php