I\'m trying to search for a value in a multi dimensional array (below is only a part of the big array) and get the key for that value but I can\'t manage it by myself. Here is w
Try this function for recursive searching:
function array_search_recursive($needle, array $haystack)
{
foreach ($haystack as $key => $value) {
$current_key = $key;
if ($needle === $value or (is_array($value) && array_search_recursive($needle, $value) !== false)) {
return $current_key;
}
}
return false;
}
$key = array_search_recursive("FR*S30*E37*2*1", $data);