Applet is an application that does not need to be downloaded and installed, it implements the dream of "at your fingertips" and opens the app with the user sweeping or searching. Also embodies the "run-to-go" concept, users do not care whether to install too many application problems. Applications will be ubiquitous, ready to use, without the need for a loading and unloading. For developers, small program development threshold is relatively low, less difficult than the app, to meet the simple basic application, Hishop Small program development is considered suitable for the Life service offline shop and non-just need low-frequency application conversion. The small program can realize the seven functions of message notification, offline scan code, and public Number association. Among them, through the Public Number association, the user can realize the public number and the small program jumps between each other. Because the small program does not exist in the portal, this article is the implementation of the Code of the PHP Lottery program to introduce a detailed analysis, the need for a friend reference
This lottery small program, in the actual test environment can also be used, for example, the test data query in the in condition, to query the random 5 ID, and then use AB to test
<?php /** * "lottery" function * * @param integer $first start number * @param integer $last End number * @ param integer $total winners * * @return String * * /function Iswinner ($first, $last, $total { $winner = array (); for ($i = 0;; $i + +) { $number = Mt_rand ($first, $last); if (!in_array ($number, $winner)) $winner [] = $number; If the number is not in the array, add it to the array if (count ($winner) = = $total) break ; Return implode (", $winner); } For Test Echo Iswinner (1, 5); ? >