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
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics