Definition :
The PHP is_file() function checks whether the given filename is a regular file.
Note: The results of this function are cached. Use clearstatcache() function to clear the cache.
is_file(file)
Parameter | Description |
---|---|
file | Required. Specifies the path to the file to check |
Lets assume that we have a file called demo.txt in the current working directory. The example below demonstrates on using this function to check whether the given filename is a regular file.
Output :
test.txt is not a regular file.
temp/test is not a regular file.
demo.txt is a regular file.