Generate a human readable random string that resembles dictionary words using PHP. Useful for captchas and other applications.
<?php
function readable_random_string($length = 6)
{
$conso = array("b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "v", "w", "x", "y", "z");
$vowels = array("a", "e", "i", "o", "u");
$string = "";
srand((double)microtime() * 1000000);
$max = $length / 2;
for ($i = 1; $i <= $max; $i++) {
$string .= $conso[rand(0, 19)];
$string .= $vowels[rand(0, 4)];
}
return $string;
}
echo readable_random_string(10);
?>