function password($length = 8, $big = 2, $digits = 2, $spec = 2)
{
$passwd = "";
for($i=0;$i < $big; $i++)
{
$passwd[] = chr(rand(65,90));
}
for($i=0;$i < $digits; $i++)
{
$passwd[] = rand(0,9);
}
for($i=0;$i < $spec; $i++)
{
$passwd[] = rand(0,1) ? chr(rand(58,64)) : chr(rand(33,47));
}
if($length-$big-$digits-$spec > 0)
{
for($i=0;$i < $length-$big-$digits-$spec; $i++)
{
$passwd[] = chr(rand(97,122));
}
}
shuffle($passwd);
return join("",$passwd);
}
http://phpdude.ru/code/4IzYc8
собственно там все :) думаю что может пригодиться новичкам или тп.