Return to Snippet

Revision: 63420
at May 6, 2013 17:41 by bigmichiel


Initial Code
// Recursive in_array functie
function in_array_r($needle, $haystack, $strict = true) {
	foreach ($haystack as $item) {
		if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
			return true;
		}
	}
	return false;
}

Initial URL

                                

Initial Description
Search recursive in array

Initial Title
in_array_r($needle, $haystack, $strict = true);

Initial Tags
array

Initial Language
PHP