Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - Will uniqid() generate alphabetical IDs?

If I use the PHP uniqid() function to generate IDs, and then I sort the IDs alphabetically in MySQL, will they be in the same order they were created?

It seems to me like they should be, since the IDs are just incrementing hexadecimal characters (at least I think they are), but does anyone know for certain?

like image 820
AndKel Avatar asked Oct 25 '25 06:10

AndKel


1 Answers

The uniqid() function generates a unique ID based on the microtime (current time in microseconds).

So I would probably say yes.

Source: http://www.w3schools.com/php/func_misc_uniqid.asp

like image 122
Chris Avatar answered Oct 26 '25 20:10

Chris