PHP file_exists()Function
Complete PHP Filesystem Reference Manual
Definition and Usage
The file_exists() function checks whether a file or directory exists.
Returns TRUE if the specified file or directory exists, otherwise returns FALSE.
Syntax
file_exists(path)
| Parameter | Description |
|---|---|
| path | Required. Specifies the path to check. |
Example
<?php
echo file_exists("test.txt");
?>
echo file_exists("test.txt");
?>
The above code will output:
1
Complete PHP Filesystem Reference Manual Other Extensions