php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33539 array_search returns wrong value
Submitted: 2005-07-01 19:38 UTC Modified: 2005-07-02 12:11 UTC
From: martin dot mohr at bytec dot de Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.11 OS: Linux 2.4.27
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: martin dot mohr at bytec dot de
New email:
PHP Version: OS:

 

 [2005-07-01 19:38 UTC] martin dot mohr at bytec dot de
Description:
------------
Using array_search with "haystack" completly numeric and the first 16 digits identic a wrong key is returned. This does not occur if one character is in the "haystack" or if there is any difference in the first 16 digits.

Reproduce code:
---------------
<?
$a = array (11 => "99999999999999999999999999",
            57 => "11022625212002021111111111",
            80 => "11022625212002021051765412");
print_r($a);
$b = array_search ("11022625212002021051765412", $a);
echo $b;
?>

Expected result:
----------------
Array ( [11] => 99999999999999999999999999 [57] => 11022625212002021111111111 [80] => 11022625212002021051765412 ) 80

Actual result:
--------------
Array ( [11] => 99999999999999999999999999 [57] => 11022625212002021111111111 [80] => 11022625212002021051765412 ) 57

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-02 12:11 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

http://no.php.net/array_search
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC