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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nathan at cjhunter dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-30 23:36 UTC] andrei@php.net
Implemented in CVS.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 23:01:33 2025 UTC