选择语言 :

 Core_Arr::is_assoc

判断一个数组是否递增key的数组

// Returns TRUE
Arr::is_assoc(array('username' => 'john.doe'));

// Returns FALSE
Arr::is_assoc('foo', 'bar');
boolean Core_Arr::is_assoc( array $array )

参数列表

参数 类型 描述 默认值
$array array Array to check
返回值
  • boolean
File: ./core/classes/arr.class.php
public static function is_assoc(array $array)
{
	// Keys of the array
	$keys = array_keys($array);

	// If the array keys of the keys match the keys, then the array must
	// not be associative (e.g. the keys array looked like {0:0, 1:1...}).
	return array_keys($keys) !== $keys;
}