rewinddir

void rewinddir(resource_pointer dir_stream) 

Rewinds the directory stream back to the start.

Returns:

Nothing

Description:

rewinddir() sets the resource pointer for a directory stream back to the start of the directory stream. One important note is that this function also causes the directory to be reread. You can use this feature to check for changes to a directory over the course of a script. See the example for details.

Version:

From versions 3.0 and 4.0

Example:

Loop through a directory until a set amount of time passes or the directory changes
 <?php $time_to_wait = 12; // For PHP3, use: $directory = '.'; $directory = getcwd (); $directory_stream = opendir ($directory); // Loop through the current entries in the directory while ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.