PHP rewinddir

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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 :

  1. $dir_name = opendir("test");  

  2. while (($file = readdir($dir_name)) !== false)  

  3. {  

  4. echo "filename: " . $file . "
    ";  

  5. }  

  6. rewinddir();  

  7. closedir($dir_name);  

  8. ?>