PHP code to list folders in a directory and make them links…

So,

I had a vision of listing all the folders within a web directory so that they were browseable – I.E if you have a parent site with lots of sub sites, how can you create a list that you can just click on to look at them?

The Solution was a snippet of PHP code I put together based on some useful online stuff, none of which answered the problem specifically, so here it is:

<?php

$dirs = array_filter(glob(‘*’), ‘is_dir’);
asort($dirs);
foreach ($dirs as $key => $val) {
    echo “<a href=’$val’>$val</a><br>n”;
}
?>
I’m quite happy with that one!
The usage is at http://www.redsumoclients.co.uk/list.php (note: the sites found here are only for development/ test purposes and are not “live”)