Generate unique reference number php
Why do you need a unique ID? If you want to generate a unique ID in your DB, then leave it to your DB, using auto-increment. Anyway, you could use a combination of microtime() and rand(). You be pretty unique. Edit, relative to OP's comment: You can't have a "always unique" if. Or if you find how, you'll win a turing award. Examples on How to Make a Random Unique User ID Using PHP. A unique user ID can be created in PHP using the uniqid () function. This function has two parameters you can set. The first is the prefix, which is what will be appended to the beginning of each ID. The second is more_entropy. If this is false or not specified, it will return 13 characters; if it's true, 23 characters will be returned. generate a reference number - PHP Development. i would like to generate a sequential number. basically i have a form and on that form is a textfield for a reference number. i would like that number generated. ideally i would like it to be in the format of 'A' 'A' and so on, or 'X', 'X' and so on. all sequential, nothing random.