Hi all
I have an array of phrases. I'd like to randomly pick phrases from the array in a loop.
I don't want to pick the same phrase more then once in the loop.
I thought I could randomly pick the phrase and then delete it before the next loop.
http://codepad.org/11l0nStX
<?php
for($i=0; $i<16; $i++){
$phrases = array('Hello Sailor','Acid Test','Bear Garden','Botch A Job','Dark Horse',
'In The Red','Man Up','Pan Out','Quid Pro Quo','Rub It In','Turncoat',
'Yes Man','All Wet','Bag Lady','Bean Feast','Big Wig');
$ran_Num = array_rand($phrases);
$ran_Phrase = $phrases[$ran_Num];
unset($phrases[$ran_Phrase]);
echo $ran_Phrase."\r\n";
echo count($phrases)."\r\n";
}
?>
Is it possible to randomly pick a different phrase from the array on each loop.