uksort
bool uksort(array array, string func)
array | Array to sort using the supplied function |
func | Function with which to sort the array keys |
Sorts the elements of an array by keys, using a user-defined function.
Returns:
TRUE on success; FALSE on failure
Description:
uksort() sorts array based on the keys, preserving the key/value relationships. The keys are sorted using a bubblesort algorithm, which uses the user-defined comparison function named by func to evaluate whether the two elements being compared are equivalent, the first is greater than the second, or the second is greater than the first. This function can be used to modify the order in which keys are sorted, rather than using the standard order supplied with ksort(). For example, ...
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.