Skip to content

Instantly share code, notes, and snippets.

@steveluscher
Created January 25, 2012 06:15
Show Gist options
  • Save steveluscher/1675040 to your computer and use it in GitHub Desktop.
Save steveluscher/1675040 to your computer and use it in GitHub Desktop.
Pronounceable password
/** Creates a pronounceable random password
* @param string $len, optional length (default 8)
* @retrun string the generated password
*/
function make_passwd($len=8)
{
$letter=array(
array("b","c","d","f","g","i","l","m","n","o","p","qu","r","s","t","v","z"),
array("a","e","i","o","u"));
$pass="";
$set=round(rand(0,1));
for ($i=0; $i<$len; $i++) {
$set=!$set;
$idx=floor(rand(0, count($letter[$set])-1));
$pass.=$letter[$set][$idx];
}
return $pass;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment