Bug #55096 [Bgs]: in_array returns true with 17 lenght int
| From: | mati at we dot ee | Date: | Fri, 01 Jul 2011 07:24:04 +0000 |
| Subject: | Bug #55096 [Bgs]: in_array returns true with 17 lenght int | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-161445@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55096&edit=1
ID: 55096
User updated by: mati at we dot ee
Reported by: mati at we dot ee
Summary: in_array returns true with 17 lenght int
Status: Bogus
Type: Bug
Package: Arrays related
Operating System: linux
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
Ok, good to now
Thank you for quick answer.
Previous Comments:
------------------------------------------------------------------------
[2011-07-01 03:09:47] aharvey@php.net
Floating point values have a limited precision. Hence a value might
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly
printing it without any mathematical operations.
If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/
Thank you for your interest in PHP.
Integers beyond PHP_INT_MAX are silently converted to floats, and float equality
is, as the above blurb says, interesting.
------------------------------------------------------------------------
[2011-07-01 03:00:33] mati at we dot ee
Description:
------------
echo in_array(9440385200600001069, array(9440385200600001036)) . '<br />';
echo in_array(9440385200600001069, array(9440385200600001036), true) . '<br />';
outputs
1
1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55096&edit=1