How can directories be read and sorted alphabetically in PHP?
To read and sort directories alphabetically in PHP, you can use the `scandir()` function to read the contents of a directory and then use `sort()` function to sort the array alphabetically. This will allow you to display the directories in alphabetical order.
// Get the list of directories
$directories = scandir('path/to/directory');
// Remove . and .. from the list
$directories = array_diff($directories, array('..', '.'));
// Sort the directories alphabetically
sort($directories);
// Display the sorted directories
foreach ($directories as $directory) {
echo $directory . "<br>";
}