← All docs

usort()

Sorts an array by values using a user-defined comparison function.

usort()

function usort(array $array, callable $callback): bool

Sorts an array by values using a user-defined comparison function.

Parameters:

  • $array (array), passed by reference
  • $callback (callable)

Returns: bool

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how usort is implemented in the compiler, see the internals page.