PHP » I/O » is_dir()

Syntax:
bool is_dir(string path)
path
A directory path.

Checks whether a path points to a directory.

The is_dir() function returns TRUE if a specified path is a directory, and FALSE otherwise.

Examples

Code:
<?php

if (is_dir("log.txt")) {
   print "log.txt is a directory<br>";
} else {
   print "log.txt is not a directory<br>";
}

if (is_dir("backup")) {
   print "backup is a directory";
} else {
   print "backup is not a directory";
}

?>
Output:
log.txt is not a directory
backup is a directory
Explanation:

"backup" is a directory and "log.txt" is a file in the current directory.

See Also: