我想尝试合并和排序一个多维数组。目前该数组如下所示:
Array
(
[0] => Array
(
[customerID] => 1234
[service] => Car
[CSA] => Jack
[status] => 3
)
[1] => Array
(
[customerID] => 1234
[service] => Cap
[CSA] => Jill
[status] => 3
)
[2] => Array
(
[customerID] => 1234456
[service] => Plate
[CSA] => Jack
[status] => 1
)
)
在这个多维数组中,customerID 将是唯一的,但是,许多二级数组具有相同的 customerID。同样,在这些阵列中,CSA 可能与状态相同。
我希望结束数组如下所示:
Array
(
[0] => Array
(
[customerID] => 1234
[service] => Car <br/> Cap
[CSA] => Jack <br /> Jill
[status] => 3
)
[2] => Array
(
[customerID] => 1234456
[service] => Plate
[CSA] => Jack
[status] => 1
)
)
现在,如果在 customerID 为索引的集合中服务相同,则不应将其添加到值字符串中。除了 CustomerID 之外的所有其他内容也是如此。
我如何用 PHP 做到这一点?