Function __global->count_directory_contents_recursively
Definitions
sources/files2.php
- Use a memory-efficient method to recursively count the number of files in a directory.This assumes the directory already exists. Uses '/' as the directory separator.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: int
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $path | PATH | No | No | required parameter | N/A | N/A | The absolute path of the directory we want to count files |
| $bitmask | ?integer | No | No | 1 | N/A | N/A | Bitmask of extra stuff to ignore (see IGNORE_* constants) (null: do not use) |
| $file_extensions | ?array | No | No | Null | N/A | N/A | Only count files of these extensions (no dots) (null: no limit) |
Returns
- Type: integer
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Use a memory-efficient method to recursively count the number of files in a directory.This assumes the directory already exists. Uses '/' as the directory separator.
*
* @param PATH $path The absolute path of the directory we want to count files
* @param ?integer $bitmask Bitmask of extra stuff to ignore (see IGNORE_* constants) (null: do not use)
* @param ?array $file_extensions Only count files of these extensions (no dots) (null: no limit)
* @return integer
*/
function count_directory_contents_recursively(string $path, ?int $bitmask = 1, ?array $file_extensions = null) : int
* Use a memory-efficient method to recursively count the number of files in a directory.This assumes the directory already exists. Uses '/' as the directory separator.
*
* @param PATH $path The absolute path of the directory we want to count files
* @param ?integer $bitmask Bitmask of extra stuff to ignore (see IGNORE_* constants) (null: do not use)
* @param ?array $file_extensions Only count files of these extensions (no dots) (null: no limit)
* @return integer
*/
function count_directory_contents_recursively(string $path, ?int $bitmask = 1, ?array $file_extensions = null) : int

