Voting

: three minus zero?
(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