I have tried so far
$result = array_map("unserialize", array_unique(array_map("serialize", $surveyData)));
I have also tried to sort out in custom way using loops but it is so much messy.
Array
(
[0] => Array
(
[question_id] => 8
[answer] => 10 patients
[question_type] => 1
[question] => How many diabetes patients do you see per month?
[question_no] => 3
[survey_id] => 2
[name] => Health Pharmacist Digital Advantage
[description] => Free One Year Subscription to Diabetes Health Pharmacist Digital Advantage magazine
)
[1] => Array
(
[question_id] => 8
[answer] => 30 patients
[question_type] => 1
[question] => How many diabetes patients do you see per month?
[question_no] => 3
[survey_id] => 2
[name] => Health Pharmacist Digital Advantage
[description] => Free One Year Subscription to Diabetes Health Pharmacist Digital Advantage magazine
)
Desired result:
Array
(
[0] => Array
(
[question_id] => 8
[answer] => Array(
[0] => 10 patients,
[1] => 30 patients,
)
[question_type] => 1
[question] => How many diabetes patients do you see per month?
[question_no] => 3
[survey_id] => 2
[name] => Health Pharmacist Digital Advantage
[description] => Free One Year Subscription to Diabetes Health Pharmacist Digital Advantage magazine
)