|
PHP. FOR, WHILE, FOREACH Loops and inside operations, PART 4 |
Random password: <?
function genkey( $length = 8 ) { mt_srand ((double) microtime() * 1000000); $puddle = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$out = ''; for($index=0; $index < $length; $index++) { $out .= substr($puddle, (mt_rand()%(strlen($puddle))), 1); }
return $out;
}
?>
|