Question : password generator php
Answered by : you
function generatePassword($length = 10) { $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?'; $password = ''; $characterCount = strlen($characters); for ($i = 0; $i < $length; $i++) { $password .= $characters[rand(0, $characterCount - 1)]; } return $password;
}
// Generate a password with the default length of 10 characters
$password = generatePassword();
echo $password;
Source : | Last Update : Tue, 19 Sep 23