You are here

public function Helpers::inArrayR in Flickr API Integration 8

Returns TRUE if a value is found in a multidimensional array.

See http://stackoverflow.com/a/4128377.

Parameters

string $needle: The value to be matched.

array $haystack: The array to match.

bool $strict: If set to TRUE also check the types of the needle in the haystack.

Return value

bool TRUE if match found.

File

src/Service/Helpers.php, line 146

Class

Helpers
Class Helpers.

Namespace

Drupal\flickr_api\Service

Code

public function inArrayR($needle, array $haystack, $strict = FALSE) {
  foreach ($haystack as $item) {
    if (($strict ? $item === $needle : $item == $needle) || is_array($item) && self::inArrayR($needle, $item, $strict)) {
      return TRUE;
    }
  }
  return FALSE;
}