How to use Directory readdir in PHP

In this article I am going to explain about readdir function in PHP.
  • 1712

PHP readdir() function

The directory readdir function is used to read and return entry from directory handle.

Syntax of  readdir function

readdir(dirstream)

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:

readdir function.jpg

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

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.