w3resource

PHP: rewinddir() function

Description

The rewinddir() function is used to rewind directory handle.

Version:

(PHP 4 and above)

Syntax:

rewinddir(dir_handle)

Parameter:

Name Description Required /
Optional
Type
dir_handle Specified directory handle, previously open by opendir(). Required Resource

Example :

<?php
$dir_name = opendir("test");
while (($file = readdir($dir_name)) !== false)
{
echo "filename: " . $file . "<br />";
}
rewinddir();
closedir($dir_name);
?>

See also

PHP Function Reference

Previous: readdir
Next: scandir



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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://www.w3resource.com/php/function-reference/rewinddir.php