PHP: closedir() function
Description
The closedir() function is used to close a directory handle previously been opened by the opendir() function.
Version:
(PHP 4 and above)
Syntax:
closedir(dir_handle)
Parameter:
Name | Description | Required / Optional |
Type |
---|---|---|---|
dir_handle | Specifies the directory handle to close | Required | Resource |
Example:
<?php
$dir_name = opendir("test");
while (($file = readdir($dir_name)) !== false)
{
echo "filename: " . $file . "<br>";
}
closedir($dir_name);
?>
See also
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/php/function-reference/closedir.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics