Created
July 20, 2016 20:24
-
-
Save fcaldarelli/e3bdc1b583f0e96a128eb93d9bc78039 to your computer and use it in GitHub Desktop.
Generate unique code string in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In this case, 4bytes, 8 charactes. | |
$bytes = 4; | |
$cstrong = true; | |
$uid = bin2hex(openssl_random_pseudo_bytes($bytes, $cstrong)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment