This function checks whether the specified file is a directory.

Syntax: is_dir(file)

Description:

The Parameter “file” is Required. It Specifies the file to be checked.

This function returns TRUE if the directory exists.

Example1:
Code:

$file = "sadique";
if(is_dir($file))
    {
  echo ("$file is a directory");
  }
else
  {
  echo ("$file is not a  directory");
  }

Output:

sadique is not a directory

Example2:
Code:

$file = "C:";
if(is_dir($file))
  {
  echo ("$file is a directory");
  }
else
  {
    echo ("$file is not a directory");
  }

Output:

C: is a directory

eXTReMe Tracker