The is_dir() function checks whether the specified file is a directory.
If the directory exists, this function returns TRUE.
is_dir(file)
parameter | describe |
---|---|
file | Required. Specifies the documents to be checked. |
Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.
<?php$file = "images";if(is_dir($file)) { echo ("$file is a directory"); }else { echo ("$file is not a directory"); }?>
The above code will output:
images is a directory