PHP/Utility Function/uniqid

Материал из Web эксперт
Перейти к: навигация, поиск

Another way to create a unique ID is to prepend the derived value with a string:

 
<?
$uniq_id = uniqid("php", TRUE);
print $uniq_id;
?>



function uniqid() generates a 13-character unique identification number based on the current time.

 
Its syntax is: int uniqid (string prefix [, boolean lcg])
<?
    $uniq_id = uniqid("");
    print $uniq_id;
?>



Random unique id

 
<?
srand ((double) microtime() * 1000000);
$uniq_id = uniqid(rand());
print $uniq_id;
?>