Skip to content

Instantly share code, notes, and snippets.

@SecureCloud-biz
Created August 19, 2014 05:28
Show Gist options
  • Select an option

  • Save SecureCloud-biz/588303b329289cf112e4 to your computer and use it in GitHub Desktop.

Select an option

Save SecureCloud-biz/588303b329289cf112e4 to your computer and use it in GitHub Desktop.
Generates Pre-set numbers/letters
<?php
function gen_uuid2($len=8) {
$hex = md5("Madison_DeSimone" . uniqid("", true));
$pack = pack('H*', $hex);
$tmp = base64_encode($pack);
$uid = preg_replace("#(*UTF8)[^A-Za-z0-9]#", "", $tmp);
$len = max(4, min(2000, $len));
while (strlen($uid) < $len)
$uid .= gen_uuid(22);
return substr($uid, 0, $len);
}
echo gen_uuid2(20);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment