is_dir

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

<?

var_dump(is_dir('file.txt'));
var_dump(is_dir('false_dir/abc'));
var_dump(is_dir('..')); //one directory up

?>
bool(false)
bool(false)
bool(true)

PHP

Home Menu