Generate random string

PHOTO EMBED

Mon Jan 18 2021 16:03:17 GMT+0000 (UTC)

Saved by @GoodGabriel #php

function generateRandomString($length = 10) {
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $charactersLength = strlen($characters);
    $randomString = '';
    for ($i = 0; $i < $length; $i++) {
        $randomString .= $characters[rand(0, $charactersLength - 1)];
    }
    return $randomString;
}
content_copyCOPY

https://stackoverflow.com/questions/4356289/php-random-string-generator