Copyright © tutorialspoint.com
| bool file_exists ( string $filename ); |
Checks whether a file or directory exists.
| Parameter | Description |
|---|---|
| filename | Path to the file or directory. |
Returns TRUE if the file or directory specified by filename exists; FALSE otherwise.
Following is the usage of this function:
<?php
$filename = '/home/httpd/index.htm';
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
?>
|
Copyright © tutorialspoint.com