Home / PHP Tips Generated By ChatGPT / Sorting an Array in Alphabetical Order in PHP Sort the elements of an array in ascending order with sort(). Source Code $array = ["banana", "cherry", "apple"]; sort($array); print_r($array); // The array is now sorted alphabetically