我有一个多维数组
Array(
[0] => Array
(
[category_id] => 1
[question_id] => 1
[option_id] => 2
[title] => Do you wear glasses?
[answer] => no
)
[1] => Array
(
[category_id] => 1
[question_id] => 2
[option_id] => 3
[title] => Your hobbies ?
[answer] => movies
)
[2] => Array
(
[category_id] => 1
[question_id] => 4
[option_id] => 8
[title] => what is your status?
[answer] => single
)
[3] => Array
(
[category_id] => 1
[question_id] => 2
[option_id] => 1
[title] => Your hobbies ?
[answer] => travel
)
)
其中第二个和第四个数组包含相同的问题(相同的类别 id 和相同的问题 id)我想组合具有相同类别 id 和问题 id 的数组。
我期待的是这个
Array(
[0] => Array
(
[category_id] => 1
[question_id] => 1
[option_id] => 2
[title] => Do you wear glasses?
[answer] => no
)
[1] => Array
(
[category_id] => 1
[question_id] => 2
[option_id] => 3
[title] => Your hobbies ?
[answer] => movies,travel
)
[2] => Array
(
[category_id] => 1
[question_id] => 4
[option_id] => 8
[title] => what is your status?
[answer] => single
)
)
意味着只结合它的答案。请帮忙 ...