Skip to content

Instantly share code, notes, and snippets.

@jan53n
Last active September 21, 2018 16:17
Show Gist options
  • Save jan53n/a4c5bf13e371e232216f3e68dc5ed3c1 to your computer and use it in GitHub Desktop.
Save jan53n/a4c5bf13e371e232216f3e68dc5ed3c1 to your computer and use it in GitHub Desktop.
A Unique Alphanumeric String with for an identification value.
// 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