I have a list of path (just strings), like this:
$data = array(
array('path' => 'foo/bar/baz'),
array('path' => 'foo/bar/baz/qux'),
array('path' => 'foo/bar'),
array('path' => 'bar/baz/foo'),
array('path' => 'baz'),
);
I would like to achieve a structure like this
Array
(
[foo] => Array
(
[bar] => Array
(
[baz] => Array
(
[qux] => null
)
)
)
[bar] => Array
(
[baz] => Array
(
[foo] => null
)
)
[baz] => null
)
Side note
- the structure displays only, non-common portions
- the leaf would be
null(nullfor me would be without children)
I know you will ask me what have you tried? the problem is: I don't know how to deal the problem in the right way
can you give me some advice, without massacre of downvote?
[baz] =>but you already have one that begins with this.null(nullfor me would be without children)