PHP is_file() Function
In this chapter you will learn:
- Definition for PHP is_file() Function
- Syntax for PHP is_file() Function
- Parameter for PHP is_file() Function
- Return for PHP is_file() Function
- Note for PHP is_file() Function
- Example - returns true if the string parameter is a file
Definition
The is_file() function checks whether the specified file is a regular file.
Syntax
PHP is_file() Function has the following syntax.
is_file(file)
Parameter
Parameter | Is required | Description |
---|---|---|
file | Required. | File to check |
Return
This function returns TRUE if it is a file.
Note
The result of this function are cached. Use clearstatcache() to clear the cache.
Example
is_file() returns true if the string parameter is a file.
For example, to check whether it is a file:
<?PHP/*from j a v a 2 s .c om*/
$filename = 'c:\boot.ini'; // Windows
$filename = '/etc/passwd'; // Unix
if (is_file($filename)) {
print 'is File !';
} else {
print 'is not a File!';
}
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP is_link() Function
- Syntax for PHP is_link() Function
- Parameter for PHP is_link() Function
- Return for PHP is_link() Function
- Note for PHP is_link() Function
- Example - PHP is_link() Function
Home » PHP Tutorial » PHP File Functions