This function allow you to unique Id containt leter and number.
Code
0) {
$out -= pow($base, $pad_up);
}
}
$out = sprintf('%F', $out);
$out = substr($out, 0, strpos($out, '.'));
} else {
// Digital number -->> alphabet letter code
if (is_numeric($pad_up)) {
$pad_up--;
if ($pad_up > 0) {
$in += pow($base, $pad_up);
}
}
$out = "";
for ($t = floor(log($in, $base)); $t >= 0; $t--) {
$bcp = bcpow($base, $t);
$a = floor($in / $bcp) % $base;
$out = $out . substr($index, $a, 1);
$in = $in - ($a * $bcp);
}
$out = strrev($out); // reverse
}
return $out;
}
]]>
don't worry about code.Parameter:
$in = to input to genearate to unique id
$to_num =indicate the result return number or leter.
$pad_up = tell to number character of unique id.
$passKey = to key to hash
Example:
echo rand_uniqid(1012,true,false,'hash1');This code will be return the unique id with number result.
echo rand_uniqid(1012,false,7,'hash1');This code will be return the unique id include leter and number result and unique id have lenght is 7.