PHP 8.5.0 Beta 3 available for testing

Voting

: min(one, four)?
(Example: nine)

The Note You're Voting On

Anonymous
15 years ago
If the array elements are unique, and are all integers or strings, here is a simple way to pick $n random *values* (not keys) from an array $array:

<?php array_rand(array_flip($array), $n); ?>

<< Back to user notes page

To Top