I\'m programming a script using PHP and MySQL and I want to get a
unique id (consisting of a string: capitals and small
letters with numbers) like: gHYtUUi5b.
You may like the way that we do it. I wanted a reversible unique code that looked "random" -a fairly common problem.
We now have a number that varies wildly between calls and is guaranteed to be less than 10,000,000,000. Not a bad start.
The reason for choosing base 34 is so that we don't worry about 0/O and 1/l collisions. Now you have a short random-looking key that you can use to look up a LONG database identifier.