You are here

function patterns_utils_key_exists in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/ \patterns_utils_key_exists()

Enhanced version of array_key_exists with support for array of keys

Returns an associative array where to each key is associated the logical value TRUE if it was found in the test array, FALSE otherwise.


mixed|Array $key: The key or set of keys to test

Return value

Array $out Associative array of boolean values for each key

See also



1 call to patterns_utils_key_exists()
taxonomy_patterns_validate in patterns_components/components/


includes/, line 229
Collectiion of general purpose functions.


function patterns_utils_key_exists($key = NULL, $array = array()) {
  $out = array();
  if (!isset($key)) {
    return $out;
  if (!is_array($key)) {
    $key = array(
  if (count($key) === 0) {
    return $out;
  foreach ($key as $k) {
    $out[$k] = array_key_exists($k, $array);
  return $out;