I would create your array of directory items, asort your array and then loop through your array to display your data on the screen.
example:
$filearray = array();
if ($fil = opendir("apps/$_GET[lang]")) {
while (($file = readdir($fil)) !== false) {
if ($file != "." && $file != "..") {
$filearray[] = trim($file);
}
}
}
asort($filearray); //sort your array
echo '<pre>'.print_r($filearray,1).'</pre>'; // just a printed out example of the sorted array
//then foreach() loop through your array to display your HTML