September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool usort(array array, string func)
| array | Array to sort using the supplied function |
| func | Function to use to sort the array |
Sorts the given scalar array with a user-defined function.
Returns:
TRUE on success; FALSE on error
Description:
usort() sorts array according to the user-defined function named by func . This can be useful for doing sorts with custom algorithms or doing non-case-sensitive sorts with alphabetic characters. When you pass usort() an array and the name of a user-defined function, it uses the bubblesort method and traverses the elements of the array to sort them. The custom function must return -1, 0, or 1 for this method to work correctly (see example). If used on an associative array, this function causes the keys ...
Read now
Unlock full access