ID: 26349 User updated by: kouber at saparev dot com Reported By: kouber at saparev dot com Status: Bogus Bug Type: Math related Operating System: Win 2000 NT PHP Version: 4.3.4 New Comment:
I see. I just didn't saw in the documentation of that function such an explanation. http://www.php.net/is-numeric I'll add a user comment, but maybe it should be better to add this in the manual itself, someday... :) Previous Comments: ------------------------------------------------------------------------ [2003-11-21 15:10:53] [EMAIL PROTECTED] Please see the note on the maximum value of floats at http://www.php.net/manual/en/language.types.float.php When is_numeric() checks a string, it tries to convert the string to a long, then a double. Anything greater than approximately 1.8e308 is too large for a double, so it becomes infinity. Try a var_dump() on the value and you'll see what I mean. (This behaviour is platform-dependent, of course.) J ------------------------------------------------------------------------ [2003-11-21 09:22:31] kouber at saparev dot com Description: ------------ is_numeric() always returns false for strings with more than 308 characters, even if all of them are digits. 308 = 255 + 63 = 2^8-1 + 2^6-1 Reproduce code: --------------- <? $s = str_repeat('6', 309); var_dump($s); var_dump(is_numeric($s)); ?> Expected result: ---------------- string(309) "666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" bool(true) Actual result: -------------- string(309) "666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26349&edit=1