I have an array like this.
Array
(
[0] => Array
(
[category] => vegetable
[type] => garden
[children] => Array
(
[0] => Array
(
[name] => cabbage
)
[1] => Array
(
[name] => eggplant
)
)
)
[1] => Array
(
[category] => fruit
[type] => citrus
)
)
What is an easy way to construct a resulting array like this using PHP?
Array
(
[0] => Array
(
[category] => vegetable
[type] => garden
[name] => cabbage
)
[1] => Array
(
[category] => vegetable
[type] => garden
[name] => eggplant
)
[2] => Array
(
[category] => fruit
[type] => citrus
)
)
I am currently working on a solution for this.