You are here

function _features_is_assoc in Features 7.2

Same name and namespace in other branches
  1. 7 features.export.inc \_features_is_assoc()

Internal. Checks whether the array is "associative".

An array is considered "associative" by this function, if:

  • it is empty (no values), or
  • it has any non-integer keys, or
  • some numeric indices are missing, e,g, [0 => $v, 1 => $v, 3 => $v].

Note: The order of numeric indices is irrelevant. E.g. [1 => $v, 0 => $v] is considered NOT associative.

Borrowed from: http://www.php.net/manual/en/function.is-array.php#96724

@internal This function is designed for internal use within @todo Needs unit tests.

Parameters

array $array: The array to be tested.

Return value

bool TRUE if the array is considered "associative".

See also

_features_sanitize().

1 call to _features_is_assoc()
_features_sanitize in ./features.export.inc
Internal. "Sanitizes" a (nested) array (or object) recursively.

File

./features.export.inc, line 1563
Contains functions that export configuration into feature modules.

Code

function _features_is_assoc($array) {
  return is_array($array) && (0 !== count(array_diff_key($array, array_keys(array_keys($array)))) || count($array) == 0);
}