Check if the specified file is a directory with is_dir() function in PHP

Description

The following code shows how to check if the specified file is a directory with is_dir() function.

Example


  // www .  j  av a  2 s  .  c om
<?php
    $file = "images";
    if(is_dir($file)){
      echo ("$file is a directory");
    }else{
      echo ("$file is not a directory");
    }
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    File »




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