Jump to content

Bundle multiple arrays!?


DeLol

Recommended Posts

Hello!

 

Could anyone help me to transform this array into the second array? I'm really lost  :(

 

Array
(
    [A] => Array
        (
            [0] => a
            [1] => B
	)
[b] => Array
        (
            [0] => a
            [1] => b
            [2] => C
	)
[C] => Array
        (
            [0] => a
            [1] => b
	)
[D] => Array
        (
            [0] => a
            [1] => b
	)
)

 

into:

Array 
( 
    [A] => Array 
        ( 
            [a] => null
            [b] => Array
                (
                    [a] => null
                    [b] => null
                    [C] => Array
                        (
                            [a] => null
                            [b] => null
                        )
                )
                  
        ) 
    [D] => Array 
        ( 
            [a] => null 
            [b] => null 
        ) 
)  

 

I want to output this:

A
|-a
|-B
  |-a
  |-b
  |-C
    |-a
    |-b

D
|-a
|-b

 

Many thanks!

Link to comment
https://forums.phpfreaks.com/topic/209007-bundle-multiple-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.