Bug #14421 Updated: Numeric string comparsion fails
| From: | sander@php.net | Date: | Tue, 11 Dec 2001 17:49:16 +0000 |
| Subject: | Bug #14421 Updated: Numeric string comparsion fails | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-73077@lists.php.net to get a copy of this message | ||
ID: 14421
Updated by: sander
Reported By: pauli.ojanen@cencei.fi
Old Status: Open
Status: Bogus
Bug Type: Strings related
Operating System: Suse Linux, Apache web server
PHP Version: 4.0.6
New Comment:
"2000000011211132516" is converted to a number, and so is "2000000011211132521".
PHP can't handle numbers that large and therefor may work incorrect.
Use === to avoid that conversion.
Previous Comments:
------------------------------------------------------------------------
[2001-12-11 05:21:58] pauli.ojanen@cencei.fi
<?php
// Values are NOT the same and it should print out
// "It worked" but it prints "PHP bugs."
if("2000000011211132516" == "2000000011211132521") {
print("PHP bugs.");
}
else {
print("It worked.");
}
?>
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14421&edit=1