I need to get time based unique id which would only consist of numbers, i was thinking to simply use something like this:
str_replace(".", "", microtime(true))
I would use this id for many things, for example comments posting, and i’m expecting quite high traffic so i would like to know how high are the chances of collision with microtime function?
And perhaps there is a better way to get numerical unique id? Just remember that it has to based on time so sorting could be done.
If you need to use a pure time based ID you need to ensure that you avoid collisions so a) use a primary key in the database and then b) use a recursive check to ensure that your time based ID has not already been taken:
I shall leave it upto you good sir to enjoy making it recursive.