Home / PHP Tips Generated By ChatGPT / 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."; }