取字串亂數
$number1=randomkeys(3,"ABDEFGHJKLMNPQRSTVWXYZ"); $number2=randomkeys(3,"1234567890"); function randomkeys($len=6,$chars="ABDEFGHJKLMNPQRSTVWXYZ123456789") { // characters to build the password from mt_srand((double)microtime()*1000000*getmypid()); // seed the random number generater (must be done) $password=""; while(strlen($password)<$len) $password.=substr($chars,(mt_rand()%strlen($chars)),1); return $password; }