Is_dir () function user guide in PHP and is_dir User Guide. In PHP, the is_dir () function User Guide. is_dir user guide function: is_dir () function: determines whether the given file name is a directory description: boolis_dir (string $ filename) if the file name is is_dir () in PHP () function User Guide, is_dir User Guide
Function: is_dir ()
Function: determines whether the specified file name is a directory.
Note:
Bool is_dir (string $ filename)
Returns TRUE if the file name exists and is a directory.
If filename is a relative path, check its relative path according to the current working directory.
Note: the result of this function is cached. For more information, see clearstatcache ().
Example 1
<?var_dump(is_dir('a_file.txt')) . "\n";var_dump(is_dir('bogus_dir/abc')) . "\n";var_dump(is_dir('..')); //one dir up?>
The above example will output:
Bool (false)
Bool (false)
Bool (true)
Example 2
<?php$file = "images";if(is_dir($file)){echo ("$file is a directory");}else{echo ("$file is not a directory");}?>
Output:
If the images directory exists, the output is:
Images is a directory
The above is all the content of this article. I hope you will like it.
Usage Guide of lift () function, is_dir usage guide function: is_dir () function: determines whether the given file name is a directory description: bool is_dir (string $ filename) if the file name...