I have an array called $ran = array(1,2,3,4);
$ran = array(1,2,3,4);
I need to get a random value out of this array and store it in a variable, how can I do this?
You can also do just:
$k = array_rand($array); $v = $array[$k];
This is the way to do it when you have an associative array.
1.4m articles
1.4m replys
5 comments
57.0k users