PHP/Utility Function/uniqid — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:07, 26 мая 2010
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>