Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to generate 8 digit random string password in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 305
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: