$path = "/example"; if (isDir($path)) { echo "The directory exists."; } else { echo "The directory doesn't exist."; }
$path = "/usr/bin/"; if (isDir($path)) { echo "The path is a directory."; } else { echo "The path is not a directory."; }These examples require the PHP Filesystem functions package/library.