$dir = opendir($BASE); while ($folder = readdir($dir)) { if($folder != '..' && $folder != '.') { echo $folder;
The code works but it does not have the folders it lists sorted in any order. What do I need to do to be able to order the folders on the display?
Thanks for any help.
read the contents of the directory in to an array, sort the array, and output it.
Well that worked, thanks.
while ($folder = readdir($dir)) { if($folder != '..' && $folder != '.') { $folder_a[$o] = $folder; $o++; } } sort($folder_a); foreach ($folder_a as $folder) {
array_push() is another option to add an element to an array.