PHP Code

Generating Random Password using PHP code?

echo password_generate(6,6);

function password_generate($min=6,$max=6){

/*has a default minimum value of 6  and maximum value of 6*/


// this variable is for to save generated password



if(($num >= 97 && $num <= 122)) $pwd.=chr($num);

else if(($num >= 65 && $num <= 90)) $pwd.=chr($num);

else if(($num >=48 && $num <= 57)) $pwd.=chr($num);

else $i–;

return $password;

// returns the generated password


It displays the random password feild with using the php code.

Hope this will be useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.