I have a two dimensional array with the following output
Array
(
[0] => Array
(
[customer_id] => 7
[language_id] => 1
[variableitem_id] => 13
[name] => QUESTION_HEADLINE
[value] => Bitte geben Sie Ihren Downloadkey ein:
)
[1] => Array
(
[customer_id] => 7
[language_id] => 1
[variableitem_id] => 15
[name] => QUESTION_BUTTON
[value] => Start!
)
)
I want to convert the output of the array to something like this
Array
(
[QUESTION_HEADLINE] => Array
(
[value] => Bitte geben Sie Ihren Downloadkey ein:
)
[QUESTION_BUTTON] => Array
(
[value] => Start!
)
)
I am using this code why it is not giving me proper array with index as names
$final = array();
foreach($data['variables_data'] as $vals){
$final[$vals['name']]['value'] = $vals['value'];
echo '<pre>';
print_r($final[$vals['name']]['value']);
echo '</pre>';
}
This should do the job. Output =>