How to generate a random, unique, alphanumeric string?
PHP 7 standard library provides the random_bytes($length) function that generate cryptographically secure pseudo-random bytes. Example: $bytes = random_bytes(20); var_dump(bin2hex($bytes)); The above example will output something similar to: string(40) “5fe69c95ed70a9869d9f9af7d8400a6673bb9ce9” More info: http://php.net/manual/en/function.random-bytes.php PHP 5 (outdated) I was just looking into how to solve this same problem, but I also want my function to create a … Read more