PHP Lottery Applet Instance Code

Source: Internet
Author: User
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);  ? >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.