Bug #78292 [Com]: NumberFormatter procedural functions dont work

From: Date: Mon, 15 Jul 2019 10:00:20 +0000
Subject: Bug #78292 [Com]: NumberFormatter procedural functions dont work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221776@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78292&edit=1 ID: 78292 Comment by: matthew at matthewsetter dot com Reported by: delboy1978uk at gmail dot com Summary: NumberFormatter procedural functions dont work Status: Open Type: Bug Package: Unknown/Other Function Operating System: any PHP Version: 7.1.30 Block user comment: N Private report: N New Comment: In addition to the bug description provided, I have the following example, using the procedural functions: $fmt = numfmt_create('en_US', NumberFormatter::DECIMAL); echo numfmt_format_currency($fmt, 32.00, "EUR")."\n"; I would expect that this would return 32,00, however, it returns 32. I've used a number of ISO 4217 currency codes (specifically USD, EUR, AUD, GBP) but the output remains the same. It's worth noting that if the float value provided to numfmt_format_currency contains a fractional part, in addition to the integral part, then the number formats as expected. Environment Details: PHP 7.3.6 / macOS 10.14.5. Previous Comments: ------------------------------------------------------------------------ [2019-07-15 09:52:50] delboy1978uk at gmail dot com Description: ------------ When using numfmt_create() and numfmt_currency(), PHP flakes out and gives us some number in Scientific Notation, instead of formatting like US currency. Look here https://3v4l.org/QgS7U Test script: --------------- <?php $fmt = numfmt_create('en_US', NumberFormatter::TYPE_CURRENCY ); echo numfmt_format_currency($fmt, 32.00, "USD")."\n"; $fmt = new NumberFormatter( 'en_US', NumberFormatter::CURRENCY ); echo $fmt->formatCurrency(32.00, "USD")."\n"; /* output as follows 3.2E1 $32.00 Expected result: ---------------- $32.00 $32.00 Actual result: -------------- 3.2E1 $32.00 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78292&edit=1

« previous php.bugs (#221776) next »