I have a function inside of a class, every time I use I got error undefined function in_array_r() inside of foreach. But when I use it outside of the class as normal function it works. I want to use this inside of the class so I will not call in every page.
public function in_array_r($needle, $haystack, $strict = false) {
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && in_array_r($needle, $item, $strict))) {
return true;
}
}
return false;
}