Return an array of random keys:
The array_rand() function returns a random key from an array, or it returns an array of random keys if you specify that the function should return more than one key.
Parameter | Description |
---|---|
array | Required. Specifies an array |
number | Optional. Specifies how many random keys to return |
Return Value: | Returns a random key from an array, or an array of random keys if you specify that the function should return more than one key |
---|---|
PHP Version: | 4+ |
Changelog: | As of PHP 5.2.10, the resulting array of keys is no longer shuffled As of PHP 4.2.0, the random number generator is seeded automatically |
Return a random key from an array:
Return an array of random string keys: