Computer >> Computer tutorials >  >> Programming >> PHP

is_file() function in PHP


The is_file() function checks whether a file is a regular file. It returns TRUE if it is a regular file.

Syntax

is_file(file_path)

Parameters

  • file_path − The path of the file.

Return

The is_file() function returns TRUE if it is a regular file.

Example

<?php
   $check = "D:/info/one.txt";
   if (is_file($check))
   echo ("Regular file!");
   else
   echo ("Not a regular file!");
?>

Output

Not a regular file!