Hi, I'm trying to use sort to alphabetize a listing of names but I'm having trouble with the functions. I need to open the list, read it into an array, sort it and then rewrite the list in alphabetic order. Here's what I have but it isn't working as expected.
//Alpha sort the directory
$fpp = fopen("listing.php", 'r');
while(!feof($fpp))
{
$line = fgets($fpp, 1024);
}
fclose($fpp);
sort($line);
reset($line);
// Rewrite the directory
$ffpp = fopen("listing.php", 'w');
fwrite($ffpp, "$line");
fclose($ffpp);
Any ideas or suggestions are most welcomed and appreciated.
Thanks in advance,
Scott