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

 Live Demo

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

Output

Not a regular file!

Updated on: 24-Jun-2020

55 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements