What is closedir in PHP Directory

In this article I am going to explain about closedir function in PHP.
  • 1626

PHP closedir() function

The directory closedir function is used to close the open directory, who is previously opened by opendir function.

Syntax of  closedir function

closedir(dirHandle)

Parameters in closedir function

It has only one parameter:

Parameter Description
dirHandle It specifies the directory handle to close.

Example of directory closedir  function

<html>
<body>

<?php
$dir = opendir("C:\wamp\www\Dinesh");
while (($file = readdir($dir)) !== false)
{
echo "filename: " . $file . "<br />";
}
closedir($dir);
?>

</body>
</html>

 

Output:

closedir 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.