
Late addendum: As Oleg Abrazhaev points out, if you want to make sure your system is actually capable of generating cryptographically strong random values at runtime, openssl_random_pseudo_bytes accepts a reference to a bool to report this.

$random_hash = bin2hex(openssl_random_pseudo_bytes(16)) The following looks just like the output of John Conde's answer, but is (supposedly) more random and less guessable: // generate a 16 byte random hex string You can then use bin2hex() to turn it into a nice alphanumeric. As we will cover this tutorial with live example to build invoice system with PHP & MySQL, so the major files for this example is following. Click on the Import tab and choose the database file (.sql) which is provided under the folder naming DATABASE FILE. The system also provides various means of payments such as cash, cheque and ATM cards. If there is any concern over the possibility of a confirmation code being guessed (and that is the whole point of issuing a code) you may wish to use a more random generator such as openssl_random_pseudo_bytes(). Create a Database with a name that is provided inside the 01 LOGIN DETAILS & PROJECT INFO.txt. Cash receipt generating system is a Point of Sales (POS) system designed to enhance the collection of payments for transactions, generate receipts and keep records of daily transactions.

The documentation for uniqid explicitly warns that it does not create "random nor unpredictable strings", and states emphatically that " This function must not be used for security purposes." The accepted answer suggests using a hash of PHP's uniqid().
