How to randomly select 5 elements from an String Array?
1
2011-03-29T09:15:17-0400
Some example:
$array = array('first', 'second', 'third', 'forth', 'fifth', 'sixth', 'seventh', 'eighth');
for ($i = 0; $i < 5; $i++)
{
$random = rand(0, count($array)-1);
print($array[$random].' ');
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments