Verify if the given filename is a directory:
| <?php $file = “images”; if(is_dir($file)) { echo (“$file is a directory”); } else { echo (“$file is not a directory”); } ?> |
What the code above might produce is:
| images is a directory |
The function is_dir() verifies if the given filename is a directory.
Note: This function caches its output. To clear the cache, use clearstatcache().
| is_dir(file) |
|
Parameter |
Description |
|
file |
Essential. gives the location of the file to be checked. |
|
Return Value: |
If the directory is present, TRUE; if not, FALSE |
|
PHP Version: |
4.0+ |