What are some best practices for handling and sorting string data from a database in PHP for use in a dropdown menu?

When handling and sorting string data from a database in PHP for use in a dropdown menu, it is important to retrieve the data from the database, sort it alphabetically, and then loop through the sorted data to create the dropdown menu options.

// Retrieve string data from the database
$data = array("Option C", "Option A", "Option B");

// Sort the data alphabetically
sort($data);

// Loop through the sorted data to create dropdown menu options
echo '<select>';
foreach ($data as $option) {
    echo '<option value="' . $option . '">' . $option . '</option>';
}
echo '</select>';