Jump to content

[SOLVED] Why does PHP have a Uniqid Function if Microtime is truly unique?


limitphp

Recommended Posts

Can be useful, for instance, if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond.

 

Microtime doesn't make any attempts to be unique, it simply returns the current time at a microsecond level.

Link to comment
Share on other sites

Can be useful, for instance, if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond.

 

Microtime doesn't make any attempts to be unique, it simply returns the current time at a microsecond level.

 

Yeah, I has posted this before you had replied to the other post pretty much answering the question in this post.

:)

 

Of course, I was thinking, I could just have the ID be auto_increment (1,2,3,4,5,etc)....

that insures that every entry is unique.

Then just attach some word to the value.

 

So then every value will be example:

1keyword, 2keyword, 3keyword, 4keyword, 5keyword

 

That will insure that people can't guess it....

 

Then md5 that value and store that in the cookie.

 

It would be unique and it would be very difficult for people to guess it, unless they found out my keyword.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.