I don't know if this exactly answers your question but here's what I use for that purpose :
srand ((double) microtime() * 1000000);
$possible="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
$str="";
while(strlen($str) < 6) {
$str.=substr($possible,(rand()%(strlen($possible))),1);
}
$password = $str;