Home  >  Article  >  Backend Development  >  Short generated random password supports special characters

Short generated random password supports special characters

巴扎黑
巴扎黑Original
2016-11-23 15:28:071220browse

function rand_word($num=12){

$re='';

$list="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~0123456789#$%^&";

$list=str_split($list);

$key=array_rand($list,$num);

foreach($key as $value){

$re .= $list[$value];

}

return $re;

}


Statement:
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
Previous article:Predefined variables PHPNext article:Predefined variables PHP