There is a function called array_rand but it only returns the key for a random element in an array. So here’s a quick function for you that can do it all in just a couple of lines.
function array_random($array) {
return $array[array_rand($array)];
}
Yes, the word array does appear four times, but that isn’t to confuse you but make sure you know it is an array.
Possibly related posts:
quick, easy, fast, yeah!
Just what I was looking for. Thanks. :)