Definition:
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.
array_rand(array, number)
Parameter | Description |
---|---|
array | Required. Specifies an array |
number | Optional. Specifies how many random keys to return |
Example1 : Given below example return random output array of key
Output : when we refresh output will change randomly
Web
Online
Promotion
Example2 : Return a random key from an array
Output : c (when we refresh output will change)