Pretty simple, however, I’ve yet to find a real straight and appropriate solution;
I’ve currently got my own function that creates a random string, by running two mt_rand() functions from 1 to maximum integers, then wrapping the results in two dechex() functions, and concatenating them into a single string.
I haven’t done the stats on it, but, the chances of two of these strings being the same is pretty low.
However, I’ll obviously need a backup solution which is why I want to perform a query against a database, and see if it exists as an entry, and if it does, re-invoke my own function to create a random string, query again, and loop until a non-existent string is found.
I’ve had a look at a ton of forum threads, and a few SO questions, but have yet to found a concise answer.
Any help would be greatly appreciated, thanks!
You need a recursive function. Something like: