rewinddir

(PHP 4, PHP 5)

rewinddirRiavvolge l'handle della directory

Descrizione

void rewinddir ( resource $dir_handle )

Reimposta il flusso della directory indicato da dir_handle all'inizio della directory.

add a note add a note

User Contributed Notes 1 note

up
0
osamahussain897 at gmail dot com
2 months ago
/* Source Code */

<?php
$dir
= "/images/";

// Open a directory, and read its contents
if (is_dir($dir)){
  if (
$dh = opendir($dir)){
   
// List files in images directory
   
while (($file = readdir($dh)) !== false){
      echo
"filename:" . $file . "<br>";
    }
   
rewinddir();
   
// List once again files in images directory
   
while (($file = readdir($dh)) !== false){
      echo
"filename:" . $file . "<br>";
    }
   
closedir($dh);
  }
}
?>

/* Result */

filename: cat.gif
filename: dog.gif
filename: horse.gif
filename: cat.gif
filename: dog.gif
filename: horse.gif
To Top