Tells whether the filename is a regular file
Syntax
is_file ( string $filename ) : bool
Parameters
filename
Path to the file.
Return
Returns TRUE if the filename exists and is a regular file, FALSE otherwise.
Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.
Examples
1
<? $filename = $_SERVER["DOCUMENT_ROOT"] . "/assets/txt/file.txt"; $return = is_file($filename); var_export($return); ?>
true
2
<? $filename = "false.txt"; $return = is_file($filename); var_export($return); ?>
false