rewinddir()
rewinddir() — Rewind directory handle.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Resets the directory stream indicated by dir_handle to the beginning of the directory.
Signature
rewinddir(?resource $dir_handle = null): void
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $dir_handle | ?resource | A directory handle resource previously opened with opendir(). If dir_handle is null the last handle opened using opendir() will be used. |
Return value
No value is returned.
Example
The PHP manual ships no example for rewinddir(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.5.0 | Using null for dir_handle is now deprecated. Instead, the last opened directory handle should be explicitly provided. |
| 8.0.0 | dir_handle is now nullable. |
See also
opendir(), readdir(), closedir(), dir(), is_dir(), glob(), scandir()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page rewinddir() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.