how can I merge this assoc arrays to one which will have the array(title, description)? GetContent function sort of data to my requirements.
function getContent($data) {
$tabs = $data->result->data->tab;
$type = findByType($tabs,'content');
$content = array();
foreach ($type->unified_content->item as $item) {
if($item->type->name == 'header') {
$content[] = array(
'title' => $item->text
);
} else {
$content[] = array(
'description' => $item->text
);
}
}
return $content;
}
vardump of foreach result, how can i merge title + description:
array(1) {
["title"]=>
string(13) "Test článku"
}
array(1) {
["description"]=>
string(20) "Nový článek test."
}
array(1) {
["title"]=>
string(15) "Test článku 2"
}
array(1) {
["description"]=>
string(22) "Nový článek test 2."
}
array(1) {
["title"]=>
string(15) "Test článku 3"
}
array(1) {
["description"]=>
string(22) "Nový článek test 3."
}