2

I have a problem, i'd like to remove the containing array (key 80) but keep its children (with all the keys and structure unchanged, apart from the parent).

Can somebody help me

Array
(
    [80] => Array
        (
            [parent] => 0
            [lng] => en
            [children] => Array
                (
                    [98] => Array
                        (
                            [children] => Array
                                (
                                    [54] => Array
                                        (
                                            [parent] => 98
                                            [lng] => en
                                        )

                                )

                            [parent] => 80
                            [lng] => en
                        )

                )

        )

)

Thank you, BR

Mission
  • 1,287
  • 3
  • 16
  • 31

2 Answers2

3

Sounds like all you need is

$children = $all[80];
VolkerK
  • 95,432
  • 20
  • 163
  • 226
3

If you do:

$array=$array[80];

you preserve the children and remove the parent

mck89
  • 18,918
  • 16
  • 89
  • 106