How to Sort Arrays by Values & Keys in PHP
Monday, August 22nd, 2011If you want to sort arrays in PHP in ascending / descending order by array values, you may use the following code snippets. First lets create an array; $array = array("Red", "Green", "Blue", "Yellow", "White", "Black"); Now lets use PHP's built-in function sort() that will sort the array by values in ascending order.