You can use following set of functions to sort arrays in php : 1) sort & rsort Sort takes array to be sorted as its first required parameter and sort_flags as its second optuional parameter. It sorts the array as well as reindexes it assigning elements 0 based numeric keys and removing any keys assigned prior to sorting. sort_flags parameter can be used to specify how the array is to be sorted, possible values are : a) SORT_REGULAR : regular sorting, items are compared normally and types are not changed b) SORT_NUMERIC : array elements are compared numerically c) SORT_STRING : array elements are compared as strings d) SORT_LOCALE_STRING : array elements are compared as string based on the current locale rsort function is similar to sort function except that it sorts the array inreverse order i.e. highest to lowest. 2) asort & arsort asort and arsort is basically used for sorting associative array. The main difference between sort and asort is that array elements retain their original keys and array is not reindexed. 3) ksort & krsort Similar asort and arsort functions, the only difference is that the array is sorted based on the key values instead of element values. 4) usort & uksort These functions are similar sort and ksort in functionality. Only difference is that you can specify a custom callback function as second parameter to specify the custom ordering of the array elements. 5) natsort & natcasesort natsort function sorts alphanumeric array elements as humans would do known as natural ordering (for example, 'img2' ahead of 'img10') while maintaining the key value relationship of array elements. natcasesort is the case insensitive version of the natsort function.