/ Published in: PHP
Search recursive in array
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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; }