php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55096 in_array returns true with 17 lenght int
Submitted: 2011-07-01 03:00 UTC Modified: 2011-07-01 03:24 UTC
From: mati at we dot ee Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 5.2.17 OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mati at we dot ee
New email:
PHP Version: OS:

 

 [2011-07-01 03:00 UTC] mati at we dot ee
Description:
------------
echo in_array(9440385200600001069, array(9440385200600001036)) . '<br />';
echo in_array(9440385200600001069, array(9440385200600001036), true) . '<br />';

outputs 
1
1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 03:09 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2011-07-01 03:09 UTC] 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:24 UTC] mati at we dot ee
Ok, good to now
Thank you for quick answer.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Jul 04 20:01:35 2025 UTC