PHP Directory Functions

By | September 29, 2022

PHP Directory Introduction
The directory functions allow you to retrieve information about directories and their contents.

Installation

The directory functions are part of the PHP core. There is no installation needed to use these functions.

PHP Directory Functions

PHP: indicates the earliest version of PHP that supports the function.

FunctionDescriptionPHP
chdir()Changes the current directory3
chroot()Changes the root directory of the current process4
dir()Opens a directory handle and returns an object3
closedir()Closes a directory handle3
getcwd()Returns the current directory4
opendir()Opens a directory handle3
readdir()Returns an entry from a directory handle3
rewinddir()Resets a directory handle3
scandir()Lists files and directories inside a specified path5

PHP Directory Constants

PHP: indicates the earliest version of PHP that supports the constant.

ConstantDescriptionPHP
DIRECTORY_SEPARATOR 3
PATH_SEPARATOR 4
Category: PHP

Leave a Reply

Your email address will not be published. Required fields are marked *