note 93045 added to function.in-array
| From: | fabien dot menager at gmail dot com | Date: | Thu, 20 Aug 2009 13:21:37 +0000 |
| Subject: | note 93045 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159691@lists.php.net to get a copy of this message | ||
<?php
/**
* Checks recursively if a value exists in an array
* @return Returns TRUE if needle is found in the array, FALSE otherwise.
* @param mixed $needle The searched value.
* @param array $haystack The array.
* @param bool $strict If the third parameter strict is set to TRUE then the in_array_recursive()
function will also check the types of the needle in the haystack.
*/
function in_array_recursive($needle, $haystack, $strict = false) {
if (in_array($needle, $haystack, $strict)) return true;
foreach ($haystack as $v) {
if (is_array($v) && in_array_recursive($needle, $v, $strict)) return true;
}
return false;
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 86.70.80.106
----
Manual Page -- http://www.php.net/manual/en/function.in-array.php
Edit -- https://master.php.net/note/edit/93045
Del: integrated -- https://master.php.net/note/delete/93045/integrated
Del: useless -- https://master.php.net/note/delete/93045/useless
Del: bad code -- https://master.php.net/note/delete/93045/bad+code
Del: spam -- https://master.php.net/note/delete/93045/spam
Del: non-english -- https://master.php.net/note/delete/93045/non-english
Del: in docs -- https://master.php.net/note/delete/93045/in+docs
Del: other reasons-- https://master.php.net/note/delete/93045
Reject -- https://master.php.net/note/reject/93045
Search -- https://master.php.net/manage/user-notes.php