Как я могу получить случайные слова, не повторяясь в PHP?Помощь
$words = preg_split('//', 'abcdefghijklmnopqrstuvwxyz0123456789', -1);
shuffle($words);
foreach($words as $word) {
echo $word . '<br />';
}
function getrandomstring($length) {
global $template;
settype($template, "string");
$template = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
/* this line can include numbers or not */
settype($length, "integer");
settype($rndstring, "string");
settype($a, "integer");
settype($b, "integer");
for ($a = 0; $a <= $length; $a++) {
$b = rand(0, strlen($template) - 1);
$rndstring .= $template[$b];
}
return $rndstring;
}