'I have this flat array:
$folders = [
'test/something.txt',
'test/hello.txt',
'test/another-folder/myfile.txt',
'test/another-folder/kamil.txt',
'test/another-folder/john/hi.txt'
]
And I need it in the following format:
$folders = [
'test' => [
'something.txt',
'hello.txt',
'another-folder' => [
'myfile.txt',
'kamil.txt',
'john' => [
'hi.txt'
]
]
]
];
How do I do this? Thanks.