generate random password in php

Hello friends,


Here is the Fast, simple, and easy way to generate readable/remeberable random password.





<?php
$randPwd = generatePassword(12);
?>








<?php

 //Generates readable/rememberable random password.
function generatePassword($length = 6) { 
$chars = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "o", "p", "r", "s", "t", "u", "v", "x", "y", "z");
$vocals = array("a", "e", "i", "o", "u");
$password = "";
mt_srand ((double) microtime() * 1000000);
for ($i = 1; $i <= $length; $i++)
$password .= ($i % 2 == 0)?$chars[mt_rand(0, count($chars) - 1)]:$vocals[mt_rand(0, count($vocals) - 1)];
return $password;
}
?>

 

 

 

Comments

Popular posts from this blog

ubuntu package installation

Drupal Bootstrap Database

How to fix 500 internal privoxy error