If you don't mind picking the same item again at some other time then you can use following code:
<?php $items = array(1,5); echo $items[rand(0, count($items) - 1)]; ?>It will display a random number from the elements of array. 1 or 3 or 5 or 1 .......
source : http://developer-paradize.blogspot.com, http://cnn.com, http://wikipedia.org
0 Response to "[Php] How to get a random value from array in PHP?"
Posting Komentar