HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

is_dir

Description

The is_dir of Filesystem for PHP tells whether the filename is a directory.

Syntax

is_dir(
    string $filename
): bool

Parameters

filename

Path to the file.

If filename is a relative filename, it will be checked relative to the current working directory. If filename is a symbolic or hard link then the link will be resolved and checked. If you have enabled safe mode, or open_basedir further restrictions may apply.

Return

Returns true if the filename exists and is a directory, false otherwise.

Examples

1 · filename · file

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt';

$return = is_dir($filename);

var_export($return);
false

2 · filename · directory

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/';

$return = is_dir($filename);

var_export($return);
true

3 · filename · parent

<?

$filename = '..';

$return = is_dir($filename);

var_export($return);
true