I have following problem. This code make a list of all files (which are in data directory), the order is files time. But how i can convert the code, that it's order to alphabetic order? I understand that variable is $otsikko, but can anyone explain how I can do this??
Regards,
Gustavus
$myDirectory = openDir("data");
$fileName = readdir($myDirectory);
$fileName = readdir($myDirectory);
while($fileName = readdir($myDirectory)) {
if($fileName != "images" && $fileName != "uusi") {
$f .= $fileName . "#";
}
}
$f = substr($f, 0, -1);
$fileNames = explode("#", $f);
rsort($fileNames);
if($fileNames[0] != "") {
for($i=0; $i<count($fileNames); $i++) {
$readFile = fopen("data/" . $fileNames[$i], "r");
if(!($readFile)) return; // Error
$otsikko = chop(urldecode(fgets($readFile, 65535)));
$aika = date("d.m.Y", $fileNames[$i]);
fclose($readFile);
$allNews .= "<tr><td><font name=\"Arial\" size=\"2\"><a href=alasivu.php?fileName=" . $fileNames[$i] . ">$otsikko</a></td><td> </font></td></tr>\n";
}