Complete PHP Array Reference
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. Default 1. Specifies how many random keys to return |
The output of the code above could be:
An array with string keys:
The output of the code above could be:
Complete PHP Array Reference
Your message has been sent to W3Schools.