Home > Backend Development > PHP Tutorial > PHP generate random password function example

PHP generate random password function example

WBOY
Release: 2016-07-25 08:51:22
Original
890 people have browsed it
  1. #Generate random password
  2. function MakePass($length)
  3. {
  4. $possible = "0123456789!@#$%^&*()_+".
  5. "abcdefghijklmnopqrstuvwxyz".
  6. "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  7. $ str = "";
  8. while(strlen($str) < $length)
  9. {
  10. $str .= substr($possible, (rand() % strlen($possible)), 1);
  11. }
  12. return( $str);
  13. }
Copy code


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template