PHP is_file() Function

P
PHP IS_WRITeABLE() Function
PHP is_executable() Function

In this article, you will learn how to check if a file is a regular file. The is_file() function in PHP checks whether the specified filename is a regular file.

what is the syntax of the IS_FILE function in php?

is_file(file)
ParameterDescription
fileRequired. Specifies the path to the file to check
PHP is_file() method

examples of the IS_FILE function

Example 1. In this example, we check whether the specified filename is a regular file.

<?php
$file = "test.txt";
if(is_file($file)) {
  echo ("$file is a regular file");
} else {
  echo ("$file is not a regular file");
}
?>
PHP IS_WRITeABLE() Function
PHP is_executable() Function

Add comment

Tutor Network

Share this

Learn PHP from A to Z