yii\helpers\BaseArrayHelper::isIndexed PHP Метод

isIndexed() публичный статический Метод

An array is indexed if all its keys are integers. If $consecutive is true, then the array keys must be a consecutive sequence starting from 0. Note that an empty array will be considered indexed.
public static isIndexed ( array $array, boolean $consecutive = false ) : boolean
$array array the array being checked
$consecutive boolean whether the array keys must be a consecutive sequence in order for the array to be treated as indexed.
Результат boolean whether the array is associative
    public static function isIndexed($array, $consecutive = false)
    {
        if (!is_array($array)) {
            return false;
        }
        if (empty($array)) {
            return true;
        }
        if ($consecutive) {
            return array_keys($array) === range(0, count($array) - 1);
        } else {
            foreach ($array as $key => $value) {
                if (!is_int($key)) {
                    return false;
                }
            }
            return true;
        }
    }