Home > Article > Backend Development > Short generated random password supports special characters
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;
}