PHP - Directory
The Directory functions allow you to retrieve information about directories and their contents.
Installation
There is no installation needed to use these functions. These functions are part of the PHP core.
Runtime Configuration
This extension has no configuration directives defined in php.ini.
PHP Directory Class
Class Description | |
---|---|
Directory | The Directory class. |
Methods | Description |
close() | Close directory handle. |
read() | Read entry from directory handle. |
rewind() | Rewind directory handle. |
PHP Directory Functions
Functions | Description |
---|---|
chdir() | Changes directory. |
dir() | Return an instance of the Directory class. |
chroot() | Change the root directory. |
closedir() | Close directory handle. |
getcwd() | Gets the current working directory. |
opendir() | Open directory handle. |
readdir() | Read entry from directory handle. |
rewinddir() | Rewind directory handle. |
scandir() | List files and directories inside the specified path. |
PHP Directory Predefined Constants
The constants below are always available as part of the PHP core.
Constants | Type | Description |
---|---|---|
DIRECTORY_SEPARATOR | String | |
PATH_SEPARATOR | String | Semicolon on Windows, colon otherwise. |
SCANDIR_SORT_ASCENDING | Integer | |
SCANDIR_SORT_DESCENDING | Integer | |
SCANDIR_SORT_NONE | Integer |