Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Generate Unique Random String With Any Character Size | unique random php generator | php unique id generator

function generateRandomShortName($length = 11): string
{
    $string = '';

    while (($len = strlen($string)) < $length) {
        $size = $length - $len;

        $bytes = random_bytes($size);

        $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size);
    }

    return $string;
}
 
PREVIOUS NEXT
Tagged: #Generate #Unique #Random #String #With #Any #Character #Size #unique #random #php #generator #php #unique #id #generator
ADD COMMENT
Topic
Name
2+1 =