Checking If a Directory Exists in PHP


Determine if a directory exists by using is_dir().

Source Code

if (is_dir('path/to/directory')) {
    echo "The directory exists.";
} else {
    echo "The directory does not exist.";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments