You are here

public static function ArrayUtils::hasNumericKeys in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/ArrayUtils.php \Zend\Stdlib\ArrayUtils::hasNumericKeys()

Test whether an array contains one or more numeric keys.

A numeric key can be one of the following:

  • an integer 1,
  • a string with a number '20'
  • a string with negative number: '-1000'
  • a float: 2.2120, -78.150999
  • a string with float: '4000.99999', '-10.10'

Parameters

mixed $value:

bool $allowEmpty Should an empty array() return true:

Return value

bool

File

vendor/zendframework/zend-stdlib/src/ArrayUtils.php, line 87

Class

ArrayUtils
Utility class for testing and manipulation of PHP arrays.

Namespace

Zend\Stdlib

Code

public static function hasNumericKeys($value, $allowEmpty = false) {
  if (!is_array($value)) {
    return false;
  }
  if (!$value) {
    return $allowEmpty;
  }
  return count(array_filter(array_keys($value), 'is_numeric')) > 0;
}