How to generate the random password in PHP?
Using below PHP script, you can generate the random password:
<?php
function generateRandomPassword() {
$salt = "abcdefghijklmnopqrstuvwxyz0123456789";
srand((double) microtime() * 1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
echo generateRandomPassword(); // Calling the function
?>
Comments
Post a Comment