PHP Array for formatting tree

0

I'm trying to transform this array

Array
(
    [0] => Array
        (
            [enc] => Array
                (
                  [enc_obs] => Continua
                )

    [1] => Array
        (
            [per] => Array
                (
                    [0] => Array
                        (
                            [per_obs] => Continuar mesmo?
                        )

                    [1] => Array
                        (
                            [enc_obs] => Continua2
                            [per] => Array
                                (
                                    [0] => Array
                                        (
                                            [enc_obs] => Continua3
                                            [per] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [per_obs] => Finaliza1
                                                        )

                                                    [1] => Array
                                                        (
                                                            [per_obs] => broker9
                                                        )

                                                )

                                        )

                                )

                        )

                )

        )

)

On something something like this

children: [
            {
                text: { name: "Account" },
                stackChildren: true,
                connectors: {
                    style: {
                        'stroke': '#8080FF',
                        'arrow-end': 'block-wide-long'
                    }
                },
                children: [
                    {
                        text: {name: "Continua"},
                        HTMLclass: "reception"
                    },
                ]
            },
            {
                text: { name: "Continuar mesmo?" },
                children: [ 
                   {

                    children: [
                            {
                                text: {name: "Continua3"}
                            },
                            {
                                children: [
                                    {
                                        text: {name: "Finaliza1"}
                                    }
                                ]
                            },
                            {
                                text: {name: "broker9"}
                            }
                        ]
                    }
                ]
            }
        ]

This code above with children data will generate a graph similar to this

I'vetriedusingseveralarraymethodsfortreeetc...butitdidnotwork.WhathashinderedmeinprogrammingiswhenIneedtoclosewith]andseparatethechildrenwith},

ThiscodeI'mtryingtogenerateisbasedon Treant.js

    
asked by anonymous 22.05.2016 / 19:22

0 answers