I'm using uniqid() in PHP to generate a UUID however, the returned string is something like: 4cca63b0d4be4
I thought UUIDs are suppose to be something like: 550e8400-e29b-41d4-a716-446655440000
How do you create a UUID in PHP?
Usually I use auto-increment in MySQL to get my unique IDs, however, sometimes I want to generate a UUID when a unique ID needs to be displayed to the user. I don't want users to get a ID for a ticket/reference for example of 1, 2, 3, etc, or even 10222. Not a good idea for users to know how many records there are in my database (to work out how many users I have etc). I'm not using a hash or hashing the UUID since that defeats the purpose of using a UUID, and i have no problems string the 128bit string. What are your comments on the chances of collisions? if i have a million records for example. Also reading on wiki i see there are 5 versions, v1 v2 v3 v4 v5... which one should i use?