note 93652 deleted from function.in-array by bjori
| From: | bjori@php.net | Date: | Fri, 01 Jan 2010 17:35:01 +0000 |
| Subject: | note 93652 deleted from function.in-array by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164520@lists.php.net to get a copy of this message | ||
Note Submitter: admin at dreamforgery dot com
----
Here's a function to see if all needles of an array are in a haystack:
<?php
function array_in_array($needles, $haystack) {
$matched_needles = 0;
foreach ($needles as $needle) {
if ( in_array($needle, $haystack) ) $matched_needles++;
}
return ($matched_needles == count($needles)) ? true : false;
}
?>