PHPis_dir() Function and example


 

PHPis_dir() Function and example

This segment of the PHP tutorial illustrates the use of file handling function is_dir() and its example

This segment of the PHP tutorial illustrates the use of file handling function is_dir() and its example

Syntax

bool is_dir(file_name);

  • The PHP is_dir() function states that whether the given path is the directory or the file
  • It returns 1 if the given path is directory

Example of PHP is_dir() Function PHP

Code
<?php

    echo
"is this directory".is_dir("c:/rose1");
    echo
"<br>is this directory".is_dir("c:/rose1/ram.txt");
?>

Output
is this directory1
is this directory

Ads