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:

$include_path (bool) – Whether to include the path as part of the filenames

Returns:

An array of file names

Return type:

array

Takes a server path as input and returns an array containing the names of all files
contained within it. The file path can optionally be added to the file names by setting
the second parameter to TRUE.

$top_level_only (bool) – Whether to look only at the specified directory (excluding sub-directories)

Returns:

An array containing info on the supplied directory’s contents

Return type:

array

Reads the specified directory and builds an array containing the filenames, filesize,
dates, and permissions. Sub-folders contained within the specified path are only read
if forced by sending the second parameter to FALSE, as this can be an intensive
operation.

$returned_values (array|string) – What type of info to return to be passed as array or comma separated string

Returns:

An array containing info on the specified file or FALSE on failure

Return type:

array

Given a file and path, returns (optionally) the name, path, size and date modified
information attributes for a file. Second parameter allows you to explicitly declare what
information you want returned.