note 110643 added to function.in-array
| From: | thomas at landauer dot at | Date: | Fri, 16 Nov 2012 12:52:10 +0000 |
| Subject: | note 110643 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192009@lists.php.net to get a copy of this message | ||
Function to check if EVERY needle-array-value is in an hackstack-array.
See Quaquaversal's (20-May-2007) array_in_array() to check if ANY needle-value is in the
hackstack-array.
<?php
function array_all_in_array($needles, $haystack) {
foreach ($needles as $needle) {
if ( ! in_array($needle, $haystack) ) {
return false;
}
}
return true;
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 178.191.169.202
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/110643
Del: integrated -- https://master.php.net/note/delete/110643/integrated
Del: useless -- https://master.php.net/note/delete/110643/useless
Del: bad code -- https://master.php.net/note/delete/110643/bad+code
Del: spam -- https://master.php.net/note/delete/110643/spam
Del: non-english -- https://master.php.net/note/delete/110643/non-english
Del: in docs -- https://master.php.net/note/delete/110643/in+docs
Del: other reasons-- https://master.php.net/note/delete/110643
Reject -- https://master.php.net/note/reject/110643
Search -- https://master.php.net/manage/user-notes.php