treng
treng

Reputation: 1685

PHP Absolutely unique, random string

Is there any php function in our time, which generates absolutely unique, random string? Or rephrase the question, how to make absolutely unique and random string in php in our time? Is it enough to combine couple of randomizing functions?

Upvotes: 1

Views: 2780

Answers (1)

David
David

Reputation: 218798

Just to be nitpicky... If it has to be unique then it's not really "random". Randomness includes the possibility of duplication, since generating a random state doesn't depend on (or refer to) previous states.

Do you just want to create a GUID? PHP has a couple methods for generating random IDs:

Some other people have also found ways to do this, it seems.

Upvotes: 7

Related Questions