Easy Tutorial
❮ Func Error Set Error Handler Func Array Push ❯

PHP uksort() Function

Complete PHP Array Reference Manual

Example

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


Definition and Usage

The uksort() function sorts an array by keys using a user-defined comparison function.

Tip: Use the uasort() function to sort an array by values 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 Error Set Error Handler Func Array Push ❯