I know that in_array() does not work on multidimensional arrays. I tried to implement this in my code:
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;
}
But I always get following message
Fatal error: Uncaught Error: Call to undefined function in_array_r()
There is a code where I need to check does my value exist in array:
class classification {
foreach ($valueArray as $values => $arrayEV) {
$valueCode = $arrayEV;
#NOW I NEED TO CHECK DOES $valueCode EXIST IN ARRAY CALLED '$v'
...
But when I add
echo in_array_r("Irix", $v) ? 'found' : 'not found';
I get that fatal error.
$this->in_array_r()instead of justin_array_r(). If it is not please provide the whole class as code to your question.