dir

PHP 4, PHP 5, PHP 7, PHP 8
dir - Return an instance of the Directory class
Manual
Code Examples

dir( string$directory, [resource|null$context = null] ): Directory|false

A pseudo-object-oriented mechanism for reading a directory. The given directory is opened.

Parameters

directory

Directory to open

context

A context stream resource.

Return Values

Returns an instance of Directory, or false in case of error.

Notes

Note:

The order in which directory entries are returned by the read method is system-dependent.

Changelog

Version Description
8.0.0 context is now nullable.

Example of dir

Show all examples for dir

PHP Version:


Function dir:

Directories Functions

Most used PHP functions