How i can iterate an array multidimensional with depth == n? [duplicate]

i have this array

Array
(
    [Ramo] => Array
        (
            [0] => Array
                (
                    [mq] => 22
                    [path] => /Ramo-0
                    [branch_name] => Ramo-A
                    [contenitore] => Array
                        (
                            [0] => Array
                                (
                                    [path] => /Ramo-0/contenitore-0
                                    [branch_name] => Cont-AA
                                )

                            [1] => Array
                                (
                                    [path] => /Ramo-0/contenitore-1
                                    [asset] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [path] => /Ramo-0/contenitore-1/asset-0
                                                    [branch_name] => Asset-ABA
                                                )

                                        )

                                    [branch_name] => Cont-AB
                                )

                            [2] => Array
                                (
                                    [path] => /Ramo-0/contenitore-2
                                    [branch_name] => cont-AC
                                )

                        )

                ) 
            [2] => Array
                (
                    [mq] => 98
                    [path] => /Ramo-2
                    [branch_name] => RAMO-B
                    [contenitore] => Array
                        (
                            [0] => Array
                                (
                                    [path] => /Ramo-2/contenitore-0
                                    [asset] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [path] => /Ramo-2/contenitore-0/asset-0
                                                    [branch_name] => ASSET-BAA

                                                )

                                            [1] => Array
                                                (
                                                    [path] => /Ramo-2/contenitore-0/asset-1
                                                    [branch_name] => ASSET-BAB

                                                )

                                        )

                                    [branch_name] => CONT-BA
                                )

                            [1] => Array
                                (
                                    [path] => /Ramo-2/contenitore-1
                                    [asset] => Array
                                        (
                                            [0] => Array
                                                (
                                                    [path] => /Ramo-2/contenitore-1/asset-0
                                                    [branch_name] => ASSET-BB

                                                )

                                        )

                                    [branch_name] => CONT-BB
                                )

                        )

                )

            [3] => Array
                (
                    [path] => /Ramo-3
                    [branch_name] => RAMO-C
                )

        )
)

i want a table with this result:

@@@
RAMO A
RAMO B
RAMO C
@@@

@@@
CONT AA RAMO A
CONT AB RAMO A
CONT BA RAMO B
CONT BB RAMO B
@@@

@@@
ASSET ABA CONT AB
ASSET BAA CONT BA
ASSET BAB CONT BA
@@@

How can I go about having that result? The elements within an array could be even more than these.
I’ve been stuck for days and can’t find a solution to that.