Menu Samaritan's Purse

UKSORT

Sort an array by keys using a user-defined comparison function

SYNTAX

uksort ( array &$array , callable $key_compare_func ) : bool

PARAMETERS

array

The input array.

key_compare_func

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.

RETURN

Returns TRUE on success or FALSE on failure.

EXAMPLES

an apple: 3
a banana: 4
the Earth: 2
John: 1

PHP