dir(3) php man page | unix.com

Man Page: dir

Operating Environment: php

Section: 3

DIR(3)									 1								    DIR(3)

dir - Return an instance of the Directory class

SYNOPSIS
Directory dir (string $directory, [resource $context])
DESCRIPTION
A pseudo-object oriented mechanism for reading a directory. The given $directory is opened.
PARAMETERS
o $directory - Directory to open o $context - Note Context support was added with PHP 5.0.0. For a description of contexts, refer to "Streams".
RETURN VALUES
Returns an instance of Directory, or NULL with wrong parameters, or FALSE in case of another error.
EXAMPLES
Example #1 dir(3) example Please note the fashion in which Directory.read(3)'s return value is checked in the example below. We are explicitly testing whether the return value is identical to (equal to and of the same type as - see Comparison Operators for more information) FALSE since otherwise, any directory entry whose name evaluates to FALSE will stop the loop. <?php $d = dir("/etc/php5"); echo "Handle: " . $d->handle . " "; echo "Path: " . $d->path . " "; while (false !== ($entry = $d->read())) { echo $entry." "; } $d->close(); ?> The above example will output something similar to: Handle: Resource id #2 Path: /etc/php5 apache cgi cli
NOTES
Note The order in which directory entries are returned by the read method is system-dependent. PHP Documentation Group DIR(3)
Related Man Pages
ecaccess-file-dir(1p) - debian
readdir(3) - php
dir(3) - php
ftp_chdir(3) - php
zip_entry_open(3) - php
Similar Topics in the Unix Linux Community
Some one look into this
Find file only from a Directory
Links Directory Disabled
need simple echo question
Solaris,PHP,Expect support