Zend - The PHP Company




Passwords

Add Code


Random password generator  

Type: code fragment
Added by: boanerges
Entered: 13/12/2003
Last modified: 02/11/2002
Rating: - (fewer than 3 votes)
Views: 3710
Generates a random password of 8 characters. (can be changed)


<?PHP
function genPass(){
$par = array();
$p_leng 8// password length
$char array_merge(range(a,z),range(0,9));
for (
$i=0;$i<$p_leng;$i++){
    
$disc mt_rand(0,count($char));
    
$par[$i] = $char[$disc];
    
$pass $pass.$char[$disc];
}
return 
$pass;
}
echo 
$password genPass();
?>


Usage Example


echo $password = genPass();


Rate This Script





Search



This Category All Categories