How to Create Random Password Using PHP

If your blog is wordpress system, after you installed blog, you may get a random password created by blog, and how to realize this kind of function you may know, source code below will give you an example.

function generatePassword($length=8)
 {
 $chars = array_merge(range(0,9),
 range('a','z'),
 range('A','Z'),
 array('!','@','$','%','^','&','*'));
 shuffle($chars);
 $password = '';
 for($i=0; $i<8; $i++) {
 $password .= $chars[$i];
 }
 return $password;
 }

,