husk nu ikke at fjerne kommentaren
function get_key_path($needle, &$haystack){
/*
created by:J. P. Svensson
This function returns the key path to a needle in a multidimensional array.
The returned value is an array of keys where the keys comes in reversed order in the array,if the needle ain't found false is returned.
*/
foreach ($haystack as $key=>$value) {
if ($needle==$value) {
$p=array();
$p[]=$key;
return $p;
}
if(is_array($value)) {
$p=get_key_path($needle, $value);
if($p!==FALSE){
$p[]=$key;
return $p;
}
}
}
return false;
}