creating a unique id
Moderator: General Moderators
creating a unique id
i need to create a unique id with php and i dont wanna use uniqid() could i possibly convert it to base 10 and still get the same exclusive results?
Re: creating a unique id
If you are just looking for a base-10 equivalent of uniqid(),
Here is a script that shows how the base-16 unique ID and its base-10 equivalent are related, and also how the ID is related to time.
Edit: This post was recovered from search engine cache.
Code: Select all
base_convert(uniqid(), 16, 10)Code: Select all
<?php
header('Content-Type: text/plain');
for ($i = 0; $i < 50; $i++)
{
$uid = uniqid();
echo $uid . ' : ' . base_convert($uid, 16, 10) . "\n";
}
?>