PHP is_dir() Function

PHP is_dir Function


Definition :

The PHP is_dir() function checks whether the given filename is a directory.

Note: The results of this function are cached. Use clearstatcache() function to clear the cache.

Syntax

  is_dir(file)

Parameter 

Parameter Description
file Required. Specifies the path to the file to check

The example below shows the usage of is_dir() function.

 Output :

demo.txt is not a directory.

temp/test is not a directory.

one directory up exists.