"Put them into an array and sort() the array. The loop through the sorted array and output at that point."
Just what I try. But, because of my lack of understanding, the output is my problem: function createLinks() { $p = 0; $handle=opendir("."); echo "<UL>\n"; while ($file = readdir($handle)){ $files[] = $file; $sorted = sort($files); if (($file == ".") || ($file == "..") || ($file == basename ($PHP_SELF))) { continue; } if(is_file($file)) { $p++; $linktext = ucfirst ($file); $linktext = substr_replace ($linktext,'',-4); echo "<LI><A HREF=\"$file\">$linktext</A>\n"; } for($i = 0; $i < $p; $i++) { //something here } echo "</UL>\n"; return true; } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php