You are here

function _ad_recursive_find in Advertisement 7.3

Recursively search an array for a key, and return its value.

Parameters

array $array: The array to be searched.

$needle: The key to search.

Return value

mixed The value of the key which was found.

1 call to _ad_recursive_find()
ad_get_view_view_mode in ./ad.module
Get the node view mode used in the ad view.

File

./ad.module, line 394
Core code for the ad module.

Code

function _ad_recursive_find(array $array, $needle) {
  $iterator = new RecursiveArrayIterator($array);
  $recursive = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST);
  foreach ($recursive as $key => $value) {
    if ($key === $needle) {
      return $value;
    }
  }
}