I have this array in PHP.
$all = array(
array(
'titulo' => 'Nome 1',
'itens' => array( 'item1', 'item2', 'item3')
),
array(
'titulo' => 'Nome 2',
'itens' => array( 'item4', 'item5', 'item6')
),
array(
'titulo' => 'Nome 4',
'itens' => array( 'item7', 'item8', 'item9')
));
I need to merge specific child arrays. In other words, I need to get the itens
column of data (which contains array-type data) as a flat result array like this:
$filteredArray = array('item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7', 'item8', 'item9');
I can do this using foreach()
, but are there any other more elegant methods?