note 116610 added to numberformatter.formatcurrency

From: Date: Thu, 29 Jan 2015 08:05:18 +0000
Subject: note 116610 added to numberformatter.formatcurrency
Groups: php.notes 
Request: Send a blank email to php-notes+get-201548@lists.php.net to get a copy of this message
This had me scratching my head. When working with certain English locales (e.g. "en_US" and "en_CA" among others but certainly not all), it is important to note that negative numbers are formatted differently between PHP 5.5 and PHP 5.6. Code: <?php $formatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY); echo $formatter->formatCurrency(-0.99, 'USD'), PHP_EOL; $formatter = new NumberFormatter('en_CA', NumberFormatter::CURRENCY); echo $formatter->formatCurrency(-0.99, 'USD'), PHP_EOL; ?> Output from PHP 5.5: -$0.99 -US$0.99 Output from PHP 5.6: ($0.99) (US$0.99) ---- Server IP: 72.52.91.14 Probable Submitter: 130.160.221.161 ---- Manual Page -- http://php.net/manual/en/numberformatter.formatcurrency.php Edit -- https://master.php.net/note/edit/116610 Del: integrated -- https://master.php.net/note/delete/116610/integrated Del: useless -- https://master.php.net/note/delete/116610/useless Del: bad code -- https://master.php.net/note/delete/116610/bad+code Del: spam -- https://master.php.net/note/delete/116610/spam Del: non-english -- https://master.php.net/note/delete/116610/non-english Del: in docs -- https://master.php.net/note/delete/116610/in+docs Del: other reasons-- https://master.php.net/note/delete/116610 Reject -- https://master.php.net/note/reject/116610 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201548) next »