The PHP uniqid() function generates a unique ID based on the microtime (the current time in microseconds).

				
					<?php
echo uniqid();
?>
				
			

Syntax

				
					uniqid(prefix, more_entropy)
				
			

Parameters

ParameterDescription
prefixSpecifies a prefix to the unique ID (useful if two scripts generate ids at exactly the same microsecond)
more_entropySpecifies more entropy at the end of the return value, making the result more unique; when set to TRUE, the return string will be 23 characters (default is FALSE, and the return string will be 13 characters long)