Benjamin Benjamin - 4 years ago 70
PHP Question

NumberFormatter::formatCurrency() output on different platforms

Take the following code:

$formatter = new NumberFormatter('fr_FR', NumberFormatter::CURRENCY);
echo $formatter->formatCurrency('-1.23', 'EUR');


On Fedora 25, the output is
-1,23 €
, which is the output I'd expect.

On CentOS 7 however, the output is
(1,23 €)
; not quite explicit for a French audience.

Where do these differences come from? I suspect they come from the
libicu
version installed on the system, but I need confirmation about this. Also I'm not sure whether PHP uses the ICU version installed on the system, or a version that's bundled at compile time.

CentOS 7 has
libicu-50.1.2-15
, and Fedora 25 has
libicu-57.1-4
, but PHP versions are the same on both systems, and all packages come from the same repository (remi), so if ICU was bundled with PHP, I would expect their versions to be identical.

Answer Source

PHP in "remi" repository (and AFAIK all 3rd party repositories) uses system libicu, as there is no bundled libicu in PHP.

(the only exception in packages in remi repository for EL-6 which use libicu 50, backported from EL-7 instead of default 4.2)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download