|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40174 is_numeric with currency values
Submitted: 2007-01-19 17:07 UTC Modified: 2007-01-20 10:44 UTC
From: sehh at altered dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.2.0 OS: Fedora Core Linux
Private report: No CVE-ID: None
 [2007-01-19 17:07 UTC] sehh at altered dot com
The function is_numeric() fails when the input is a value with thousand and decimal separators.

For example: 4.000,56 or 4,000.56.

We had a short discussion about this in #php irc channel and found out the following:

"4,000.56" = is USA notation
"4.000,56" = is European notation

They are perfectly valid numeric values, used in currency/weight/cubic centimeters/etc.

Suggested solutions:

1) Both notations should be accepted.

2) Only one notation should be accepted and PHP will decide which one, based on the Locale of the server/setup.

Any other suggestion is welcome.

Reproduce code:
Reproduction code:


$dolars = "4,000.56";
$euros = "4.000,56";

$rc = is_numeric($dolars);

$rc = is_numeric($euros);


Expected result:
is_numeric should have returned TRUE in both cases.

Actual result:
is_numeric returns false for both.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-19 17:14 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

 [2007-01-20 10:44 UTC] sehh at altered dot com
I'm sorry, i dont understand why this isn't a bug, since both numbers are perfectly valid but still rejected by is_numeric.

I went through the documentation but i can't find anything related to this issue. The docs say that is_numeric should allow an optional decimal part.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 00:05:44 2022 UTC