private function find($needle, $haystack) {
foreach ($haystack as $name => $file) {
if ($needle == $name) {
return $file;
} else if(is_array($file)) { //is folder
return $this->find($needle, $file); //file is the new haystack
}
}
return "did not find";
}
< /code>
Этот метод ищет конкретный ключ в ассоциативном массиве и возвращает связанное с ним значение. Есть некоторая проблема с рекурсией.
Подробнее здесь: https://stackoverflow.com/questions/397 ... earching-a
Мобильная версия