rewinddir

It rewinds directory handle and can be used to check for changes in a directory.

Example

<?php
$dir = opendir(“/var/www/test/”);
while (($file = readdir($dir)) !== false)
echo  $file . “<br />”;
rewinddir($dir);
closedir($dir);
?>

Output

index.php
..
.