php8.5
Home/ Manual/ dir / functions/ closedir

closedir

PHP function Edit on GitHub ✎

(PHP 4, PHP 5, PHP 7, PHP 8)

Close directory handle

Description

closedir(resource|null $dir_handle = null): void

Closes the directory stream indicated by dir_handle.

Parameters

dir_handle

A directory handle resource previously opened with opendir(). If dir_handle is null the last handle opened using opendir() will be used.

Return Values

Void

Changelog

VersionDescription
8.5.0Using null for dir_handle is now deprecated. Instead, the last opened directory handle should be explicitly provided.
8.0.0dir_handle is now nullable.

Examples

For a complete example refer to the opendir() documentation.

See Also

Source: reference/dir/functions/closedir.xml · from the official PHP manual (php/doc-en)