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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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-2020 The PHP Group
All rights reserved.
Last updated: Tue Jul 07 09:01:26 2020 UTC