Generate Random String

Description: This will return a character based on the give input number. All you have to do is feed it a random number and x amount of times.

<?PHP
 
$Length = 5; //length of string
$Start = 65;  //Where to start from on ascii table
$End = 90;   //where to end on the table
 
FOR($K = 0; $K < $Length; $K++){
    $Str .= CHR(ROUND(RAND($Start, $End)));
}
 
ECHO $Str;
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.