wrz 08
Szuka rekursywnie w głąb tablicy
/*
*
* Szuka rekursywnie w głąb tablicy
*
* @param array $haystack tablica
* @param string $needle wartość
* @param string $index cecha
* @return mixed
*
*/
function recursiveArraySearch($haystack, $needle, $index = null) {
$aIt = new RecursiveArrayIterator($haystack);
$it = new RecursiveIteratorIterator($aIt);
while ($it->valid()) {
if (((isset($index) AND ($it->key() == $index)) OR (!isset($index))) AND ($it->current() == $needle)) {
return $aIt->key();
}
$it->next();
}
return false;
}

