How can the user modify the PHP script to only output directories in the directory?

To modify the PHP script to only output directories in the directory, you can use the `is_dir()` function to check if each item in the directory is a directory before outputting it. This way, only directories will be displayed.

$dir = './'; // Directory path

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if (is_dir($dir . $file)) {
                echo $file . "<br>";
            }
        }
        closedir($dh);
    }
}