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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 - 25 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Thu Jun 30 08:05:45 2022 UTC