How to use Directory readdir in PHP
In this article I am going to explain about readdir function in PHP.
PHP readdir() function
The directory readdir function is used to read and return entry from directory handle.
Syntax of readdir function
Parameters in readdir function
It has only one parameter:
Parameter |
Description |
dirstream |
It specifies the directory handle to use. |
Example of directory readdir function
<html>
<body>
<?php
$dir = opendir("C:\wamp\www\Dinesh");
while (($file = readdir($dir)) !== false)
{
echo "filename: " . $file . "<br />";
}
closedir($dir);
?>
</body>
<html>
|
Output:

You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here