One of the most common applications is issuing licenses online. In the real world, licenses are issued on paper and signed by both parties. In the online world, this can be done efficiently with an online contract which can be traced by issuing a contract number. Contract numbers are the best way to track those licenses; with every licensing agreement, there should an accompanying licensing contract. Simple PHP Contract Generation Script To understand how to generate contract numbers, let’s consider a basic example: <?php echo mt_rand(min, max); echo '<br />'; ?> This piece of random code will generate random number between min and max. So for example, if you need to generate a random number between 10000 and 15000, the code would look like this: <?php echo mt_rand(10000, 15000); echo '<br />'; ?> Bear in mind that 10,000 is the minimum random number that will be generated and 15,000 is the maximum random number that will be generated. There are a countless number of applications for a PHP random number generator script; these may include games, random number quizzes, number-based passwords, etc. If you've learned PHP before, you must have met the PHP random number function rand(). This is the classic random number function. In the simple random number generator script above, we are using: mt_rand(); The only difference between mt_rand() and rand() is speed. The mt_rand() function is capable of processing four times faster than the old random generator script.
blog comments powered by Disqus |