I need to select a random item (img1, img2, etc.) from simple nested arrays. I'm sure this is easy but I am stumped. The array has this format:
Array
(
[0] => Array
(
[homepage_image] => img1
)
[1] => Array
(
[homepage_image] => img2
)
)
$fields is the name of the main array. I've tried using:
$random = array_rand($fields);
But of course that just gives me 0 or 1. How do I randomly get img1, img2, etc?