PHPize Online / SQLize Online

Popular

usort

Tags: PHP 5.x PHP 7.x PHP 8.x

usort — Sort an array by values using a user-defined comparison function.

Description

usort(
    array &$array, 
    callable $callback
): bool
Sorts array in place by values using a user-supplied comparison function to determine the order.

Parameters

array
The input array.
callback
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 Values

Always returns true.

usort - New snippets