← All docs

array_rand()

Pick one or more random keys out of an array.

array_rand()

function array_rand(array $array): int

Pick one or more random keys out of an array.

Parameters:

  • $array (array)

Returns: int

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

Internals

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