This is why it has microsecond precision. For the record, the underlying function to uniqid appears to be roughly as follows:$m=microtime(true) sprintf('%8x%05xn',floor($m),($m-floor($m)).1000000) In other words, first 8 hex chars = Unixtime, last 5 hex chars = microseconds. If moreentropy isTRUE, it will be 23 characters.moreentropyIf set to TRUE, uniqid will add additionalentropy (using the combined linear congruential generator) at the endof the return value, which increases the likelihood that the resultwill be unique. ParametersprefixCan be useful, for instance, if you generate identifierssimultaneously on several hosts that might happen to generate theidentifier at the same microsecond.With an empty prefix, the returned string willbe 13 characters long.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |