Home > Article > Backend Development > How to use php is_file function?
php is_file() function is used to determine whether a given file is a regular file. The syntax is "is_file(file)". The parameter file is the file to be checked; if the file exists and is a regular file, then Returns TRUE, otherwise returns FALSE.
php is_file() function
is_file() function checks whether the specified file is a regular file.
Syntax:
is_file(file)
Parameters:
● file: required. Specifies the documents to be checked.
Return value: If the file exists and is a regular file, it returns TRUE, otherwise it returns FALSE.
Note: The results of this function will be cached. Please use clearstatcache() to clear the cache.
php is_file() function usage example
<?php var_dump(is_file('a_file.txt')); echo "<br>"; var_dump(is_file('/usr/bin/')); ?>
Output:
bool(false) bool(false)
The above is the detailed content of How to use php is_file function?. For more information, please follow other related articles on the PHP Chinese website!