How to use Filesystem is dir in PHP

In this article I am going to explain about is_dir function in PHP
  • 1615

PHP is_dir() Function

The filesystem is_dir function checks whether the specified file is a directory or not.

Syntax of is_dir function

is_dir(file)

Parameters in is_dir  function

It has only one parameter:

Parameter Description
file It specifies the file to check.

Example of filesystem is_dir function

<html>

<body>
 

<?php

$fileName = "C:\wamp\www\Dinesh\Mcn.txt";

if(is_dir($fileName))

  {

  echo ("Mcn.txt is a directory");

  }

else

  {

  echo ("Mcn.txt is not a directory");

  }

?>
 

</body>

</html>

 

Output:

isdirfunctionphp.jpg

You may also want to read these related articles :
here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.