Created
August 19, 2014 05:28
-
-
Save SecureCloud-biz/588303b329289cf112e4 to your computer and use it in GitHub Desktop.
Generates Pre-set numbers/letters
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 | |
| 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