What are some alternative methods to achieve the same result as the provided PHP code for listing directories?

The provided PHP code uses the `scandir()` function to list directories, but there are alternative methods to achieve the same result. One alternative method is to use the `glob()` function with the `GLOB_ONLYDIR` flag to list directories only.

$directories = glob('*', GLOB_ONLYDIR);
foreach ($directories as $directory) {
    echo $directory . "<br>";
}