What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



opendir — Returns a resource pointer for use by the readdir() , rewinddir() , or closedir() functions.


mixed opendir(dir);
string dir: Directory pathname


Resource pointer on success; FALSE on error


opendir() opens directory dir and returns a resource pointer to a read-only directory stream. (The term stream refers to a communication channel to a file, process, or device.) The resource pointer is used by readdir() , rewinddir() , and closedir() to manipulate the directory stream.

The function returns FALSE if the open_basedir configuration directive is set and directory dir is not below a directory specified in open_basedir. FALSE is also returned if a directory stream for the directory could not be opened.


If opendir() fails because a directory stream could not be opened to the directory, a warning is generated. To suppress the warning, place a single @ before the function call:

$directory_stream = @ opendir ('directory_path');


From versions 3.0 and 4.0


Example 246. List all entries in the parent directory of the current working directory

$directory = '..';

$directory_stream = @ opendir ($directory)
    or die ("Could not open a directory stream for <i>$directory</i>");

// Display information about the directory stream
print_r ($directory_stream);

while ($entry = readdir ($directory_stream)) {
    // Skip directory entries that are not files
    if (! is_file ("$directory/$entry"))

       print "<br />\n$entry";

PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at The authors of this book have elected not to choose any options under the OPL. This online book was obtained from and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.