How can PHP arrays be sorted using the sort() function?

To sort PHP arrays using the sort() function, you simply need to call the sort() function passing the array you want to sort as an argument. This function will rearrange the elements of the array in ascending order based on their values. It is important to note that the keys of the array will be reset after sorting.

$fruits = array("apple", "orange", "banana", "grape");
sort($fruits);

foreach ($fruits as $fruit) {
    echo $fruit . " ";
}