Last active
September 21, 2018 16:17
-
-
Save jan53n/a4c5bf13e371e232216f3e68dc5ed3c1 to your computer and use it in GitHub Desktop.
A Unique Alphanumeric String with for an identification value.
This file contains 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
// https://codebriefly.com/unique-alphanumeric-string-php/ | |
function unique_code($id, $limit) | |
{ | |
$randomId = $id . mt_rand(); | |
return substr(base_convert(sha1(uniqid($randomId)), 16, 36), 0, $limit); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment