Array
(
    [первая] => Array
        (
            [3] => третья
            [4] => четвертая
        )

    [вторая] => Array
        (
            [пятая] => Array
                (
                    [7] => седьмая
                    [8] => восьмая
                )

            [6] => шестая
        )

)
Array
(
    [0] => Array
        (
            [id] => 0
            [name] => корневая
            [parent_id] => -1
        )

    [1] => Array
        (
            [id] => 1
            [name] => первая
            [parent_id] => 0
            [3] => Array
                (
                    [id] => 3
                    [name] => третья
                    [parent_id] => 1
                )

            [4] => Array
                (
                    [id] => 4
                    [name] => четвертая
                    [parent_id] => 1
                )

        )

    [2] => Array
        (
            [id] => 2
            [name] => вторая
            [parent_id] => 0
            [5] => Array
                (
                    [id] => 5
                    [name] => пятая
                    [parent_id] => 2
                    [7] => Array
                        (
                            [id] => 7
                            [name] => седьмая
                            [parent_id] => 5
                        )

                    [8] => Array
                        (
                            [id] => 8
                            [name] => восьмая
                            [parent_id] => 5
                        )

                )

            [6] => Array
                (
                    [id] => 6
                    [name] => шестая
                    [parent_id] => 2
                )

        )

)