ID:               40174
 User updated by:  sehh at altered dot com
 Reported By:      sehh at altered dot com
 Status:           Bogus
 Bug Type:         Math related
 Operating System: Fedora Core Linux
 PHP Version:      5.2.0
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2007-01-19 17:14:04] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php



------------------------------------------------------------------------

[2007-01-19 17:07:21] sehh at altered dot com

Description:
------------
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:

<?php

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

$rc = is_numeric($dolars);
var_dump($rc);

$rc = is_numeric($euros);
var_dump($rc);

?>

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


Actual result:
--------------
is_numeric returns false for both.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40174&edit=1

Reply via email to