Check whether the specified file is a regular file in PHP

Description

The following code shows how to check whether the specified file is a regular file.

Example


/*from   ww w.  ja  v  a 2  s  .  c  o m*/
<?php
    $file = "test.txt";
    if(is_file($file)){
      echo ("$file is a regular file");
    }else{
      echo ("$file is not a regular file");
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




Directory
DirectoryIterator
Drive
File
File Permission
File Read Save
FileSystemIterator
Path
Zip