sono un minchione![]()
manca il return anche nella chiamata ricorsiva della funzione
Codice PHP:
function getLevel(&$source, $toSearch,$level = 1)
{
foreach($source as $key=>$value){
if(is_array($value)){
RETURN getLevel($value, $toSearch, $level+1);
}else{
if($value == $toSearch){
return $level;
}
}
}
}