You are here

public static function WebformArrayHelper::isAssociative in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Utility/WebformArrayHelper.php \Drupal\webform\Utility\WebformArrayHelper::isAssociative()

Determine if an array is an associative array.

Parameters

array $array: An array.

Return value

bool TRUE if array is an associative array.

See also

http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-a...

3 calls to WebformArrayHelper::isAssociative()
WebformArrayHelper::isSequential in src/Utility/WebformArrayHelper.php
Determine if an array is a sequential array.
WebformElementStates::isDefaultValueCustomizedFormApiStates in src/Element/WebformElementStates.php
Determine if an element's #states array is customized.
WebformTableTrait::getTableSelectOptionTitle in src/Plugin/WebformElement/WebformTableTrait.php
Get table selection option title/text.

File

src/Utility/WebformArrayHelper.php, line 54

Class

WebformArrayHelper
Provides helper to operate on arrays.

Namespace

Drupal\webform\Utility

Code

public static function isAssociative(array $array) {
  return array_keys($array) !== range(0, count($array) - 1);
}