Reading dir for pseudo-object-oriented mechanisms. The given dir is on. Both properties are available once the dir has been pulled. The handle property can be used with other dir functions such as readdir(), rewinddir() and closedir()
dir - an instance of the returned Directory class,
Description
dir
dir(
String$path;
Resource$Handling;
String changed to (invalid)
void rewind(void)
Invalid close (invalid)
)
Reading dir for pseudo-object-oriented mechanisms. The given dir is on. Both properties are available once the dir has been pulled. The handle property can be used with other dir functions such as readdir(), rewinddir() and closedir(). The path attribute is set to the path's dir opening. There are three methods: read, rewind and close.
Example
Example of #dir()
Please note the fashion where the return value of dir::read() is checked in the example below. We explicitly test if the return value is the same (equivalent and of the same type - see comparison operators for more information) to false, because otherwise, any dir item whose name evaluates to false will stop the loop.
$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "n";
echo "Path: " . $d->path . "n";
while (false !== ($entry = $d->read())) {
echo $entry."n";
}
$d->close();
?>