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
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: 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

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: Sun Apr 28 19:01:28 2024 UTC