This function will sort an array by its values using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function.
Note: If two members compare as equal, their order in the sorted array is undefined.
Note: This function assigns new keys to the elements in array . It will remove any existing keys that may have been assigned, rather than just reordering the keys.
Parameters
array
The input array.
cmp_function
The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
Return Values
Returns TRUE on success or FALSE on failure.
ChangeLog
Version
Description
4.1.0
A new sort algorithm was introduced. The cmp_function doesn't keep the original order for elements comparing as equal.