Easy Tutorial
❮ Func Misc Eval Func Mysqli Num Fields ❯

PHP uasort() Function

Complete PHP Array Reference Manual

Example

Sort the elements of the $arr array by key value using a user-defined comparison function:


Definition and Usage

uasort() sorts an array by key values using a user-defined comparison function.

Note: Use the uksort() function to sort an array by key names, which uses a user-defined comparison function for sorting.

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 Misc Eval Func Mysqli Num Fields ❯