Function __global->get_directory_contents
Definitions
sources/files2.php
- Get the contents of a directory, recursively. It is assumed that the directory exists.Always uses '/' as the directory separator.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $path | PATH | No | No | required parameter | N/A | N/A | The path to search |
| $rel_path | PATH | No | No | Blank (empty string) | N/A | N/A | The path we prepend to everything we find (intended to be used inside the recursion) |
| $bitmask | ?integer | No | No | 1 | N/A | N/A | Bitmask of extra stuff to ignore (see IGNORE_* constants) (null: do not use) |
| $recurse | boolean | No | No | True | N/A | N/A | Whether to recurse (if not, will return directories as files) |
| $files_wanted | boolean | No | No | True | N/A | N/A | Whether to get files (if not, will return directories instead of files) |
| $file_extensions | ?array | No | No | Null | N/A | N/A | File extensions to limit to (no dots), if $files_wanted set (null: no limit) |
Returns
- The contents of the directory
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Get the contents of a directory, recursively. It is assumed that the directory exists.Always uses '/' as the directory separator.
*
* @param PATH $path The path to search
* @param PATH $rel_path The path we prepend to everything we find (intended to be used inside the recursion)
* @param ?integer $bitmask Bitmask of extra stuff to ignore (see IGNORE_* constants) (null: do not use)
* @param boolean $recurse Whether to recurse (if not, will return directories as files)
* @param boolean $files_wanted Whether to get files (if not, will return directories instead of files)
* @param ?array $file_extensions File extensions to limit to (no dots), if $files_wanted set (null: no limit)
* @return array The contents of the directory
*/
function get_directory_contents(string $path, string $rel_path = '', ?int $bitmask = 1, bool $recurse = true, bool $files_wanted = true, ?array $file_extensions = null) : array
* Get the contents of a directory, recursively. It is assumed that the directory exists.Always uses '/' as the directory separator.
*
* @param PATH $path The path to search
* @param PATH $rel_path The path we prepend to everything we find (intended to be used inside the recursion)
* @param ?integer $bitmask Bitmask of extra stuff to ignore (see IGNORE_* constants) (null: do not use)
* @param boolean $recurse Whether to recurse (if not, will return directories as files)
* @param boolean $files_wanted Whether to get files (if not, will return directories instead of files)
* @param ?array $file_extensions File extensions to limit to (no dots), if $files_wanted set (null: no limit)
* @return array The contents of the directory
*/
function get_directory_contents(string $path, string $rel_path = '', ?int $bitmask = 1, bool $recurse = true, bool $files_wanted = true, ?array $file_extensions = null) : array

