Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use is_dir() function in php ?
The is_dir() function is used for checking a specified file in a directory and returns TRUE if the directory exists.
syntax of is_dir()
is_dir(file)
file is a required parameter
you can see below example:
<?php
//here defina a variable of a directory
$file = "img";
//here call is_dir()
if(is_dir($file))
{
echo ("Sucess ! $file is a directory");
}
else
{
echo ("Error ! $file is not a directory");
}
?>
The output will come following of above example
Sucess!img is a directory
0 Comment(s)