uniqid (prefix, more_entropy);
A unique website ID can be created in PHP using the uniqid () function.
This function has two parameters that can be set.
This is what will be appended to the beginning of each ID.
If this is false or not specified it will return 13 characters, if it is true then 23 characters will be returned.
Below are some examples:
/*creates a unique id with the ‘sa’ prefix*/
$a = uniqid(sa); echo $a; echo "<br />";
/*creates a longer unique id with the ‘sa’ prefix*/
$b = uniqid (sa, true); echo $b; echo "<br />";
/*creates a unique ID with a random number as a prefix – this is more secure than a static prefix*/
$c = uniqid (rand (),true); echo $c; echo "<br />";
/*this md5 encrypts the username from above, so its ready to be stored in your database*/
$md5c = md5($c); echo $md5c;