Create Unique AlphaNumeric

Submitted by:J Kamy81

Date added:04 December, 2018

Category:PHP

PHP Code to create Unique AlphaNumeric

Tags: unique , alphanumeric

Code Snippet:


function MakeUnique($length=16) {
$salt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$len = strlen($salt);
$makepass = '';
mt_srand(10000000*(double)microtime());
for ($i = 0; $i < $length; $i++) {
$makepass .= $salt[mt_rand(0,$len - 1)];
}
return $makepass;
}

 
 

Comments