PHP closedir() Function

PHP closedir Function


Definition :

In php  closedir() Function is inbuilt function.The closedir() Function is used to close a directory handle. The directory handle to be closed is sent as a parameter to the closedir() function and the closedir() closes the directory handle. The directory handle must be previously opened by the opendir() function.

Syntax

   closedir(dir)

Parameter 
Parameter Description
dir Optional. Specifies the directory handle resource previously opened with opendir(). If this parameter is not specified, the last link opened by opendir() is assumed

Given below example Open a directory, read its contents, then close:

Output : Directory Opened Successfully.