public static function ArrayUtils::isHashTable in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-stdlib/src/ArrayUtils.php \Zend\Stdlib\ArrayUtils::isHashTable()
Test whether an array is a hash table.
An array is a hash table if:
1. Contains one or more non-integer keys, or 2. Integer keys are non-continuous or misaligned (not starting with 0)
For example: <code> $hash = array( 'foo' => 15, 'bar' => false, ); $hash = array( 1995 => 'Birth of PHP', 2009 => 'PHP 5.3.0', 2012 => 'PHP 5.4.0', ); $hash = array( 'formElement, 'options' => array( 'debug' => true ), ); </code>
Parameters
mixed $value:
bool $allowEmpty Is an empty array() a valid hash table?:
Return value
bool
File
- vendor/
zendframework/ zend-stdlib/ src/ ArrayUtils.php, line 162
Class
- ArrayUtils
- Utility class for testing and manipulation of PHP arrays.
Namespace
Zend\StdlibCode
public static function isHashTable($value, $allowEmpty = false) {
if (!is_array($value)) {
return false;
}
if (!$value) {
return $allowEmpty;
}
return array_values($value) !== $value;
}