note 59875 deleted from language.types.string by colder
| From: | colder@php.net | Date: | Tue, 17 Oct 2006 18:26:35 +0000 |
| Subject: | note 59875 deleted from language.types.string by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118649@lists.php.net to get a copy of this message | ||
Note Submitter:
----
RE www.feisar.de
<?php
$x1 = '111111111111111111';
$x2 = '111111111111111112';
echo ($x1 == $x2) ? "true\n" : "false\n";
?> // prints true;
You are right about need to use === to force a string to string comparison.
However as the number exceed the 32 bit range PHP is comparing the floating point not the integer
values.
Both have a float values of 1.11111111111E+017