I have an array of arrays containing filepaths
Array
(
[0] => Array
(
[0] => cat/file1.php
)
[1] => Array
(
[0] => dog/file2.php
)
[2] => Array
(
[0] => cow/file3.php
)
[3] => Array
(
[0] => cow/file4.php
)
[4] => Array
(
[0] => dog/bowl/file5.php
)
)
and need to convert it into a single multi-dimensional array holding the file names based on those file paths i.e.
Array
(
[cat] => Array
(
[0] => file1.php
)
[dog] => Array
(
[0] => file2.php
[bowl] => Array
(
[0] => file5.php
)
)
[cow] => Array
(
[0] => file3.php
[1] => file4.php
)
)
I have been experimenting with exploding the string and using for/foreach loops to build up an array non-recursively/recursively but have been unsuccessful so far