note 60696 deleted from function.in-array by peehaa
| From: | peehaa@php.net | Date: | Mon, 10 Apr 2017 07:50:21 +0000 |
| Subject: | note 60696 deleted from function.in-array by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209018@lists.php.net to get a copy of this message | ||
Note Submitter:
----
in_arrayr -- Checks if the value is in an array recursively
Description
bool in_array (mixed needle, array haystack)
<?php
function in_arrayr($needle, $haystack) {
foreach ($haystack as $v) {
if ($needle == $v) return true;
elseif (is_array($v)) return in_arrayr($needle, $v);
}
return false;
}
// i think it works
?>