random alphanumeric password generator code example
Example: random password generator
function rand_string( $length ) {
$str = "";
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
}
return $str;
}
//and call the function this way:
$mypass = rand_string(10);