hyperf-chat/app/Helper/ArrayHelper.php

26 lines
437 B
PHP
Raw Normal View History

2021-08-28 16:11:38 +08:00
<?php
declare(strict_types=1);
namespace App\Helper;
class ArrayHelper
{
/**
* 判断是否为关联数组
*
* @param array $items
* @return bool
*/
public static function isRelationArray(array $items): bool
{
$i = 0;
foreach (array_keys($items) as $value) {
if (!is_int($value) || $value !== $i) return true;
$i++;
}
return false;
}
}