Dir Function-Converts a directory name to an object
The Dir function converts a directory name to an object and returns. The returned object can call 2 properties and 3 methods.
The properties and methods that can be called are as shown in the table:
properties and methods | TD valign= "Top" >
properties and methods |
|
handle properties |
Returns the directory ID |
rewind () method |
Reset Directory identity |
path properties |
return hit Open Directory path |
close () method |
Close directory |
read () method |
Read directory |
, |
  |
The example applies the Dir () function to get the directory ID, path, and name of all subdirectories and files in that directory.
<? PHP $dir = Dir ("C:/windows"); Echo "This directory is identified as:". $dir->handle. " </br> "; Echo "The directory's path is:". $dir->path. " </br> "; Echo "All subdirectories and files of this directory are as follows:"; while ($read = $dir, read ()) Echo $read. " </br> "; $dir->rewind (); $dir->close ();
Dir function of the directory file handler-converts the directory name to an object