How to output a sorted PHP array
In PHP, you can use the sort() function to sort an array, and then use a loop to iterate through the array and output the sorted results. Here is a simple example:
$fruits = array("apple", "banana", "orange", "grape", "cherry");
sort($fruits);
foreach ($fruits as $fruit) {
echo $fruit . "<br>";
}
Running the above code will produce the following output:
apple
banana
cherry
grape
orange