PHP usort() Function
Complete PHP Array Reference Manual
Example
Sort the elements of the $a array using a user-defined comparison function:
Run Example »
Definition and Usage
usort() sorts an array using a user-defined comparison function.
Syntax
usort(
array,myfunction
);
| Parameters | Description |
|---|---|
| array | Required. Specifies the array to sort. |
| myfunction | Optional. A string defining a callable comparison function. If the first argument is <, =, or > the second argument, the comparison function must return an integer <, =, or > 0 accordingly. |
Technical Details
| Return Value: | Returns TRUE on success, FALSE on failure. |
|---|---|
| PHP Version: | 4+ |
Complete PHP Array Reference Manual