$datas = $this->dataGroup($matchsInfo, 'match_id');
/**
* @param array $dataArr 需要分组的数据
* @param string $keyStr 分组依据
* @return array
*/
protected function dataGroup(array $dataArr, string $keyStr)
{
$newArr = [];
foreach ($dataArr as $k => $val) {
$newArr[$val[$keyStr]][] = $val;
}
return $newArr;
}
网友评论