Use array_rand() to randomly pick one or more keys from an array

Use array_rand() to randomly pick one or more keys from an array

array_rand() allows you to select one or more random keys from an array. It returns the selected key(s) from the array, which can be useful for tasks like randomizing the order of elements or selecting random items.

← Back to Tips List