Hello Reader's you want to generate the 8 digit password with random characters (lower case, upper case and number), Then this function will work for you.
Lets see how genrate the password :-
$ASCIRangeFrom = 48;
$ASCITo = 122;
$MakeRandomInText = "";
$MakeRandomInText_length = 8;
for ($i = 0; $i < $MakeRandomInText_length; $i++) {
$ascii_no = round( mt_rand( $ASCIRangeFrom , $ASCITo ) );
$MakeRandomInText .= chr( $ascii_no );
}
echo $MakeRandomInText;
This function will generate 8 digit random text, The range is from numbers (48) through capital and lower case letters (122) and till the count equal to 8 it will generate a new random characters from this range.
Now in the last $MakeRandomInText will concatenate all the digits to make one single string.
0 Comment(s)