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
Place the selected values an a new array then check if it exists in the new array if not add it.
($c = count($phrases))) $default = $c;
$keys = array_rand($phrases, $default);
$newPhrases = array();
foreach($keys as $key){
if(!isset($newPhrases[$key])){
$newPhrases[$key] = $phrases[$key];
}
}
print_r($newPhrases);