![]() |
| Home | Apache | PHP | Ubuntu | MySQL | Linux | HTML | Win | CSS | Perl | Javascript | Rants | Retro |
|
||
| Create a random password using PHP Create a password in PHP with numbers and letters This function creates a random password using PHP. <?php function createPassword($length) { $chars = "234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $i = 0; $password = ""; while ($i <= $length) { $password .= $chars{mt_rand(0,strlen($chars))}; $i++; } return $password; } $password = createPassword(8); echo "Your 8 character password is: $password"; ?> - Visit totallyPHP to download other great PHP Scripts |