I'm running this code:

PHP Code:
if ($handle opendir('/home/vbshelf/public_html')) {
    
$d 0$f 0;
    while (
false !== ($file readdir($handle))) {
        if (
$file != "." && $file != "..") {
            if (
is_dir($file)) {
                
$dirs[$d] = $file;
                
$d $d 1;
            } else {
                
$files[$f] = $file;
                
$f $f 1;
            }
        }
    }
    
    
closedir($handle);
    
sort($dirs);
    
sort($files);
    for (
$i 0$i count($dirs); $i++) {
        echo 
"<b>" $dirs[$i] . "</b><br>\n";
    }
    for (
$i 0$i count($files); $i++) {
        echo 
$files[$i] . "<br>\n";
    }

This is the only thing I could come up with to sort the directories and files in alphabetical order. Is this the best way to do it, or is there an easier approach?