Generate Random Password
Free Scripts :: PHP :: String :: Generate Random Password
Author: Salman Javaid
Website: http://www.salman.be
Website: http://www.salman.be
- Generate random password.
- Generate random string.
- Generate varification code.
Function accepts a length parameter and returns randomly generated password.
Function:
function generatePassword ($length = 2)
{
$password = "";
$possible = "0123456789bcdfghjkmnpqrstvwxyz";
$i = 0;
while ($i < $length) {
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
if (!strstr($password, $char)) {
$password .= $char;
$i++;
}
}
return $password;
}
Calling The Function:
echo generatePassword ($length = 10);
Output:
df1h1rtere




