Sub-folders contained within the directory will be mapped as well. If
you wish to control the recursion depth, you can do so using the second
parameter (integer). A depth of 1 will only map the top level directory:

$map=directory_map('./mydirectory/',1);

By default, hidden files will not be included in the returned array. To
override this behavior, you may set a third parameter to true (boolean):

$map=directory_map('./mydirectory/',FALSE,TRUE);

Each folder name will be an array index, while its contained files will
be numerically indexed. Here is an example of a typical array: