|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18612 array_search has wrong output
Submitted: 2002-07-28 08:55 UTC Modified: 2002-07-28 09:15 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: b-roeser at gmx dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.1.2 OS: Linux 2.2.14
Private report: No CVE-ID: None
 [2002-07-28 08:55 UTC] b-roeser at gmx dot net
I wrote a small script:

	$a = max($array);
	$key = array_search($a, $array);
	echo $a."-".$key;

I expected the following output: 5-Array
Because there are two elements 5 in the Array: 0 and 1
But I got the following Output: 5-1

I read the manual and saw, that array_search should give an ouput of type "mixed". So I expect this to be a bug, because I didn't get an array.

Thanks, Beefy.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-28 09:15 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 09 02:05:54 2022 UTC