closedir

It closes directory handle

Example

<?php
$path = “/var/www/test/”;
if (is_dir($path)) {
if ($dir = opendir($path)) {
echo $directory = readdir($dir);
closedir($dir);
}
}
?>

Output

index.php