Dir

A directory, or dir, is a named collection of files on the file system.

A dir may also be called a folder.

There is a magic constant called __DIR__, which holds the current directory of the current file.

<?php

    $d = dir('/path/to/folder');
    while (false !== ($fileOrDir = $d->read())) {
       echo $fileOrDir.PHP_EOL;
    }
    $d->close();

    print_r(scanddir('/path/to/folder'));

?>

Documentation

See also File system.

Related : File, dirname, File System, Path