-
- var_dump(is_dir('a_file.txt')) . "n";
- var_dump(is_dir('bogus_dir/abc')) . "n";
- var_dump(is_dir('.. ')); //one dir up
- ?>
-
Copy code
output:
bool(false)
bool(false)
bool(true)
Example 2:
-
- $file = "images";
- if(is_dir($file))
- {
- echo ("$file is a directory");
- }
- else
- {
- echo ( "$file is not a directory");
- }
- ?>
Copy the code
output:
images is a directory
|