PHP » I/O » is_file()

Syntax:
bool is_file(string filename)
filename
A filename.

Checks whether a path points to a file.

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

Examples

Code:
<?php

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

if (is_file("backup")) {
   print "backup is a file";
} else {
   print "backup is not a file";
}

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

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

See Also: