hyperf-chat/app/Helpers/ArrayHelper.php

26 lines
438 B
PHP
Raw Normal View History

2021-08-28 16:11:38 +08:00
<?php
declare(strict_types=1);
2021-08-31 22:33:41 +08:00
namespace App\Helpers;
2021-08-28 16:11:38 +08:00
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;
}
}