There is this function :
mt_rand(1,5)
=> randomly selects between 1 and 5.
and another method:
$items = array(1, 4, 5, 7, 8);
echo $items[array_rand($items)];
My question is about second method.
I want to use it in this way. echo array_rand(1,4,5,7,8);
Is there a way to do this, or how can I do it? I would like to use the function without defining the array first. Everything in one place. thanks!
Note: I want to use it for unordered list.