Are there any best practices for structuring directory trees in PHP arrays for easy manipulation?

When structuring directory trees in PHP arrays for easy manipulation, it is best to use a nested array structure where each directory is represented as a key with its subdirectories or files as nested arrays. This allows for easy traversal and manipulation of the directory tree.

$directoryTree = [
    'folder1' => [
        'subfolder1' => [
            'file1.txt',
            'file2.txt'
        ],
        'subfolder2' => [
            'file3.txt'
        ]
    ],
    'folder2' => [
        'file4.txt'
    ]
];