You are here

function resmushit_recursiveFind in reSmush.it image style optimizer 7.2

Parameters

array $array:

$needle: Recursively finds key in an array and returns its value. See https://stackoverflow.com/questions/3975585/search-for-a-key-in-an-array...

Return value

mixed

1 call to resmushit_recursiveFind()
resmushit_effect in ./resmushit.inc

File

./resmushit.inc, line 252
Additional functions.

Code

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