For simplicity I have an array:
Array (
[0] => Array
(
[content] => Item One
[type] => Breakfast
)
[1] => Array
(
[content] => Item Two
[type] => Breakfast
)
[2] => Array
(
[content] => Item One
[type] => Lunch
)
[3] => Array
(
[content] => Item One
[type] => Dinner
)
)
What is the most efficient way to create a new multidimensional array where it would combine on matching key "type"? Like below. Current trying in a foreach. Are there any built in functions for this?
Array (
[0] => Array
(
[content] => Item One
[type] => Breakfast
),
(
[content] => Item Two
[type] => Breakfast
)
[1] => Array
(
[content] => Item One
[type] => Lunch
),
[2] => Array
(
[content] => Item One
[type] => Dinner
)
)