mercredi 3 octobre 2018

i want to convert 1 dimensional array to multi dimensional array [duplicate]

This question already has an answer here:

i want to convert this array

    Array
(
    [0] => flight
    [1] => user
    [2] => ijkhd8a9ssd8das89
    [3] => profile
    [4] => images
)

to

Array
(
    [flight] => Array
        (
            [user] => Array
                (
                    [ijkhd8a9ssd8das89] => Array
                        (
                            [profile] => Array
                                (
                                    [images] => Array
                                        (

                                        )

                                )

                        )

                )

        )

)

what should i do? nested for loops are not working because i don't know how can i handle more than 5 nested loops the number of nesting can be random 3 4 5 6 7 any.. how can i handle this? can anyone provide the code for that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire