Random password generation using PHP.
Option-1
echo substr(md5(uniqid()), 0, 8);
Option-2
function rand_password($length){
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$chars .= '0123456789' ;
$chars .= '!@#%^&*()_,./<>?;:[]{}\|=+';
$str = '';
$max = strlen($chars) - 1;
for ($i=0; $i < $length; $i++)
$str .= $chars[rand(0, $max)];
return $str;
}
echo rand_password(16);
No comments:
Post a Comment
Please leave your comments and we will be reply you back ASAP
vikas agrawal