我有一个数组,我需要按键合并并使用该键的值创建一个新数组。我已经搜索和搜索没有结果。任何帮助都会很棒!
原始数组
Array
(
[0] => Array
(
[name] => Key 1
[value] => Value 1
)
[2] => Array
(
[name] => Key 1
[value] => Value 2
)
[3] => Array
(
[name] => Key 2
[value] => Value 1
)
[4] => Array
(
[name] => Key 1
[value] => Value 3
)
[5] => Array
(
[name] => Key 2
[value] => Value 2
)
)
最终数组应如下所示
Array
(
[0] => Array
(
[name] => Key 1
[value] => Array
(
[0] => Value 1
[1] => Value 2
[2] => Value 3
)
)
[1] => Array
(
[name] => Key 2
[value] => Array
(
[0] => Value 1
[1] => Value 2
)
)
)