|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45833 Enable MessageFormatter to select custom currency
Submitted: 2008-08-16 09:32 UTC Modified: 2021-11-11 11:15 UTC
From: mathieuk at gmail dot com Assigned:
Status: Open Package: I18N and L10N related
PHP Version: 5.3.0alpha1 OS: MacOSX
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mathieuk at gmail dot com
New email:
PHP Version: OS:


 [2008-08-16 09:32 UTC] mathieuk at gmail dot com
Feature Request for the intl extension

The MessageFormatter is capable of formatting a number in a currency 
format. This is only marginally useful because it always uses the 
currency symbol for the locale given to it. 

It probably wouldn't be uncommon to want to display a currency in your 
own currency format, but using a different currency symbol.

Reproduce code:

$msgfmt = MessageFormatter::create('nl_NL', 'Price (USD): {0,number,currency}');

/* I'm assuming the format {0,number,currency} is not editable to something like {0,number,currency,USD} because it is defined in a underlying library. So I propose the following new method: */


echo $msgfmt->format(array(15.95));


Expected result:
Price (USD): $ 15,00

Actual result:
(without the imagined setCurrency call)

Price (USD): ? 15,00


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-13 21:25 UTC] sam at rmcreative dot ru
Do you mean any of existing currencies? If so, you can do it via specifying it in locale string via "@currency". See
 [2016-12-31 00:26 UTC]
-Package: Feature/Change Request +Package: intl
 [2021-11-11 11:15 UTC]
-Package: intl +Package: I18N and L10N related
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Dec 04 02:05:53 2022 UTC