Home > Article > Backend Development > How to generate a locally unique identifier LUID using php
In fact, just One line: return MD5(microtime()); Logically, the string returned by microtime() is already unique. After testing, even if microtime() is executed continuously, the return value will have a difference of more than 100us. When the user clicks, it will be transmitted on the network and then sent to the server. The processing interval is much more than a few tens of ms, and adding md5 will only complicate the results. |