PHP is_file() function
PHP provides is_file() function to indicate whether the specified file is a regular file.
Syntax
is_file(string filename)
Here, filename is the name of the file or file path. This function returns a boolean value either TRUE or FALSE. If the specified filename is a regular file, it returns TRUE otherwise it returns FALSE.
Example 1
<?php
$filename = 'test.txt';
if(is_file($filename)) {
echo("$filename is a regular file.");
}
else {
echo("$filename is not a regular file.");
}
?>
Output of the above code -
test.txt is a regular file.
Related PHP Functions
PHP array_reverse() functionPHP array_diff() function
PHP array_key_exists() function
PHP array_push() function
PHP array_search() function
PHP class_exists() function
PHP curl_setopt() function
PHP die() function
PHP dirname() function
PHP each() function
PHP explode() function
PHP file_exists() function
PHP function_exists() function
PHP getenv() function
PHP is_readable() function
PHP ksort() function
PHP mkdir() function
PHP ob_start() function
PHP parse_url() function
PHP str_repeat() function
PHP substr() function