Created
January 25, 2012 06:15
-
-
Save steveluscher/1675040 to your computer and use it in GitHub Desktop.
Pronounceable password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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