ネストされた配列について質問があります。私はGoogleとstackoverflowで検索しましたが、私のニーズに合った解決策を見つけることができませんでした:-/
次の配列があります。
Array
(
[0] => Array
(
[name] => Europe
[children] => Array
(
[0] => West
[1] => East
[2] => South
[3] => North
[4] => Zimbabwe
)
)
[1] => Array
(
[name] => West
[children] => Array
(
[0] => Germany
[1] => France
[2] => Switzerland
[3] => Netherlands
[4] => Belgium
[5] => Luxembourg
[6] => United Kingdom
[7] => Ireland
)
)
[2] => Array
(
[name] => Germany
[children] =>
)
[3] => Array
(
[name] => France
[children] =>
)
)
ネストされたものに変換したいと思います。つまり、次のことを意味します。
Array
(
[0] => Array
(
[name] => Europe
[children] => Array
(
[0] => Array
(
[name] => West
[children] => Array
(
[0]=> Array
(
[name] => Germany
)
[1]=> Array
(
[name] => France
)
)
)
[2] => Array
(
[name] => East
[children] => Array
(
[0]=> Array
(
[name] => Poland
)
[1]=> Array
(
[name] => Austria
)
)
)
)
)
)
アイデアはありますか?
前もって感謝します!