How to generate a unique id in PHP?

In Php, we can create a unique id in PHP using uniqid() function. This is the best way to generate unique id in PHP, However we can say php generate unique id for mysql, php unique id generator anything.

Examples For Creating a Unique Id:-

1. //creates a unique id $id = uniqid(); 
   echo $a; echo "<br>";

2. //create a unique id with random $id = uniqid(rand(), true);
    echo $c;
3. //this md5 encrypts the username from above, so its ready to be stored in your database $md5c = md5($c); 
    echo $md5c;
How to upload excel and CSV file in CodeIgniter framework to MySQL
How can we get the IP address of the client in PHP?