PHP is_dir() Function

PHP is_executable() Function
PHP glob() Function

In this article, you will learn how to check if the specified name is the name of a file or directory. The is_dir() function in PHP checks whether the specified filename is a directory.

what is the syntax of the IS_DIR function in php?

is_dir(file)
ParameterDescription
fileRequired. Specifies the path to the file to check
PHP is_dir() method

examples of the IS_DIR function

Example 1. In this example, we check whether the specified filename is a directory.

<?php
$file = "images";
if(is_dir($file)) {
  echo ("$file is a directory");
} else {
  echo ("$file is not a directory");
}
?>
PHP is_executable() Function
PHP glob() Function
en English
X
Scroll to Top