generate password php code



Generate Password
function generate_password(){
$chars[0] = "abcdeghijklmnpqrstvwxyz"; // 4 chars
$chars[1] = "ABCDEFGHIJKLMNPQSTVWXYZ"; // 2 chars
$chars[2] = "012345789"; // 2chars
$chars[3] = "$#@!%^&*_-+"; // 2chars
$cc=[4,2,2,2];  //
for($g=0;$g<4;$g++){
for($i=0;$i<$cc[$g];$i++){
$key[]= substr($chars[$g],(rand()%(strlen($chars[$g]))), 1);
}
}
shuffle($key);
return implode("",$key);
}

Leave a Reply

Your email address will not be published. Required fields are marked *