What is the shortest unique ID that can be created with PHP but without using a database? I guess it's something based on date+time (24 hour time format?) but how short can it be?
Asked
Active
Viewed 1,332 times
0
-
Depends on how often you need it. – Tim3880 May 31 '15 at 17:50
-
This question is a solution looking for a problem to solve. Why dont you state the problem and give some context if you want some valuable input ? – YvesLeBorg May 31 '15 at 17:53
-
How many unique ids are you going to need? That will determine the number of bits that you must have to make sure that there will be enough unique ids. – James Newton May 31 '15 at 18:10
1 Answers
1
For an PHP inbuilt solution you could look into uniqid
(http://php.net/manual/en/function.uniqid.php).
$id = uniqid('',true);
Alternatively you could create a UUID
. For example see: PHP function to generate v4 UUID