June 1999
Intermediate to advanced
540 pages
21h 39m
English
The following functions are used to manipulate directories. For example, to open the current directory and read in all the entries, you can do something like this:
$handle = opendir('.');
while($entry = readdir($handle)) {
echo "$entry<br>;
}
closedir($handle);PHP supports a dir class that represents a directory:
class dir(string directory)
This class has properties for the directory handle and class and methods for reading, rewinding, and closing the directory.
Here are the directory functions supported by PHP:
Change the current directory
Close the directory connection identified by the dir_handle
Open a directory and return a dir_handle
Read a directory entry from dir_handle
Rewind dir_handle back to the start
Read now
Unlock full access