I have a script that searches a folder on my server for pdf files then displays links to them on a web page in an unordered list. My questions is... is it possible to change the order that these files are displayed? Eg. alphabeticaly? I can't work out how these files are being displayed by default... it doesn't appear to be by modified date or alphabeticaly?

Any help greatly appreciated!

PHP Code:

= new DOMDOcument (); 
$ul $dom->appendChild ($dom->createElement ('ul')); 
    foreach (
glob ('*.pdf') as $pdf) { 
$li $ul->appendChild ($dom->createElement ('li')); 
$a $li->appendChild ($dom->createElement ('a')); 
$a->appendChild ($dom->createTextNode (str_replace ('_'' 'pathinfo ($pdfPATHINFO_FILENAME)))); 
$a->setAttribute ('href'$pdf); 
$a->setAttribute ('type''application/pdf');