I am trying to do a search of a multidimensional array in order to append stuff to specific elements. I got a function that does a search and returns the specific part of that array, but I need the key so I can do $array[key]
edits.
Function to get array
function arraySearch($array, $key, $value)
{
$results = array();
if (is_array($array))
{
if (isset($array[$key]) && $array[$key] == $value)
$results[] = $array;
foreach ($array as $subarray)
$results = array_merge($results, arraySearch($subarray, $key, $value));
}
return $results;
}
I don't really know how to edit this to get the key from the array.