There is a PHP array like this
Array
(
[Name/First] => John
[Name/Last] => Doe
[Age] => 20
[Address/Postal/City] => New York
[Address/Postal/Zip] => 10003
[Address/Billing/City] => Los Angeles
[Phone] => 123456789
[Foo/Bar/Foo2/Bar2] => test
)
I want to build a multidimensional array from that based on the keys exploded by some divider character like /
The expected result is like this:
Array
(
[Name] => Array
(
[First] => John
[Last] => Doe
)
[Age] => 20
[Address] => Array
(
[Postal] => Array
(
[City] => New York
[Zip] => 10003
)
[Billing] => Array
(
[City] => Los Angeles
)
)
[Phone] => 123456789
[Foo] => Array
(
[Bar] => Array
(
[Foo2] => Array
(
[Bar2] => test
)
)
)
)
Should I use some recursive functions for that?