PHP/Utility Function/uniqid

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

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

   <source lang="html4strict">

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

 </source>
   
  


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

   <source lang="html4strict">

Its syntax is: int uniqid (string prefix [, boolean lcg]) <?

   $uniq_id = uniqid("");
   print $uniq_id;

?>

 </source>
   
  


Random unique id

   <source lang="html4strict">

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

 </source>