我有以下数组,我想将同一家公司的所有用户分组在一起。目前,每个用户都会显示一个公司 ID,有时一个公司下有 2 个或更多用户。所以我有点想恢复它并显示公司下的用户而不是用户下的公司。我是怎么做到的
Array
(
[0] => Array
(
[User] => Array
(
[id] => 1
[company_id] => 20
[type] =>
)
)
[1] => Array
(
[User] => Array
(
[id] => 6
[company_id] => 21
[type] =>
)
)
[2] => Array
(
[User] => Array
(
[id] => 7
[company_id] => 22
[type] =>
)
)
[3] => Array
(
[User] => Array
(
[id] => 14
[company_id] => 21
[type] =>
)
)
[4] => Array
(
[User] => Array
(
[id] => 15
[company_id] => 22
[type] =>
)
)
[5] => Array
(
[User] => Array
(
[id] => 16
[company_id] => 21
[type] =>
)
)
)
)