Easy Tutorial
❮ Func String Ltrim Func String Md5 File ❯

PHP usort() Function

Complete PHP Array Reference Manual

Example

Sort the elements of the $a array using a user-defined comparison function:


Definition and Usage

The usort() function sorts an array using a user-defined comparison function.

Syntax

Parameter Description
array Required. Specifies the array to sort.
myfunction Optional. A string that defines a callable comparison 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.

Technical Details

Return Value: Returns TRUE on success, FALSE on failure.
PHP Version: 4+
--- ---
❮ Func String Ltrim Func String Md5 File ❯