<?php // The function with a default length of 8 characters function mkpass($length = 8)
{
// Create a list of characters and digits
$foo = array_merge
(
range("0", "9"),
range("a", "z"),
range("A", "Z")
);
// A loop to build the randomized string
for ($i;$i<$length;$i++)
{
$rand_char = array_rand($foo);
$string .= $foo[$rand_char];
}
return($string);
}
echo "<pre>Password: ".mkpass()."</pre>n";
?>
|
|