PHP UniqueID:
Generate unique ID in PHP
A unique ID can be created in PHP using the uniqid () function.

uniqid():Returns the unique identifier, as a string.
Here are some examples:

 //creates a unique id with the 'unique' prefix
 $a = uniqid('unique');
 echo $a;
 echo "<br>";
 //creates a longer unique id with the 'unique' prefix
 $b = uniqid ('unique', true);
echo $b;
 echo "<br>";
 //creates a unique ID with a random number as a prefix
 $c = uniqid (rand (),true);
 echo $c;
 echo "<br>";
 //this md5 encrypts the username from above
 $md5c = md5($c);
 echo $md5c;

 Using current time

//You can also use strtotime ("now"); 
echo "<br>";

Using custom unique_code function

function unique_code()
    $int = rand(0,9);
    $a_z = "0123456789";
    $rand_letter = $a_z[$int];