php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12741 Array needle support for array search
Submitted: 2001-08-14 11:12 UTC Modified: 2001-08-30 23:36 UTC
From: nathan at cjhunter dot com Assigned: andrei (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.5 OS: Linux 2.2
Private report: No CVE-ID: None
 [2001-08-14 11:12 UTC] nathan at cjhunter dot com
I am requesting that the functions in_array and array_search support an array type for their needle arguments. This feature would allow these functions to search for an array in an array of arrays. 

i.e.
<?

$needle = array(3,4);
$haystack = array( array(1,2), array(3,4), array(5,6) );

if(in_array($needle, $haystack)){
	echo "Yes";
}else{
	echo "No";
}

?>

Outputs:

Warning: Wrong datatype for first argument in call to in_array in test.phtml

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-30 23:36 UTC] andrei@php.net
Implemented in CVS.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC