我有这样一个多维数组:
Array
(
[0] => Array
(
[date] => 2017-11-22
[triger] => triger1
[count] => 6
)
[1] => Array
(
[date] => 2017-11-11
[triger] => triger2
[count] => 16
)
[2] => Array
(
[date] => 2017-11-15
[triger] => triger2
[count] => 8
)
)
我希望每个触发器键创建一个单独的子数组,其中包含给定键的所有数据。我想对其进行排序,并从结果中创建一个如下所示的新外观:
Array
(
[triger1] => Array
(
[0] => Array
(
[date] => 2017-11-22
[triger] => triger1
[count] => 6
)
)
[triger2] => Array
(
[0] => Array
(
[date] => 2017-11-11
[triger] => triger2
[count] => 16
)
[1] => Array
(
[date] => 2017-11-15
[triger] => triger2
[count] => 8
)
)
)