Try this code. The is_dir() function, which excludes non-directories, would automatically exclude your index.php file.
<?php
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && is_dir($entry) ) {
echo "<a href=\"$entry\">$entry</a><br>";
}
}
closedir($handle);
}
?>