php.net |  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
Votes:1
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:

<?php
	$array[0]=5;
	$array[1]=5;
	$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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-28 09:15 UTC] eru@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
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Apr 05 20:01:28 2020 UTC