I have an array where I want to search the uid
and get the key of the array.
Assume we have the following 2-dimensional array:
<
/**
* searches a simple as well as multi dimension array
* @param type $needle
* @param type $haystack
* @return boolean
*/
public static function in_array_multi($needle, $haystack){
$needle = trim($needle);
if(!is_array($haystack))
return False;
foreach($haystack as $key=>$value){
if(is_array($value)){
if(self::in_array_multi($needle, $value))
return True;
else
self::in_array_multi($needle, $value);
}
else
if(trim($value) === trim($needle)){//visibility fix//
error_log("$value === $needle setting visibility to 1 hidden");
return True;
}
}
return False;
}