You are here: Home // Directory functions
rewinddir
(PHP3 , PHP4 )
rewinddir – rewind directory handle
Description
void rewinddir (int dir_handle)
Resets the directory stream indicated by dir_handle to the beginning of the directory.
readdir
(PHP3 , PHP4 )
readdir – read entry from directory handle
Description
string readdir (int dir_handle)
Returns the filename of the next file from the directory. The filenames are not returned in any particular order.
Example 1. List all files in the current directory
<?php
$handle=opendir('.');
echo "Directory handle: $handle\n";
echo "Files:\n";
while (($file = readdir($handle))!==false)
opendir
(PHP3 , PHP4 )
opendir – open directory handle
Description
int opendir (string path)
Returns a directory handle to be used in subsequent closedir(), readdir(), and rewinddir() calls.
closedir
(PHP3 , PHP4 )
closedir – close directory handle
Description
void closedir (int dir_handle)
Closes the directory stream indicated by dir_handle. The stream must have previously been opened by opendir().
dir
(PHP3 , PHP4 )
dir – directory class
Description
new dir (string directory)
A pseudo-object oriented mechanism for reading a directory. The given directory is opened. Two properties are available once directory has been opened. The handle property can be used with other directory functions such as readdir(), rewinddir() and closedir(). The path property is set
chdir
(PHP3 , PHP4 )
chdir – change directory
Description
int chdir (string directory)
Changes PHP’s current directory to directory. Returns FALSE if unable to change directory, TRUE otherwise.















































