PHP gets the specified number of cell contents of the specified array in a random array

Source: Internet
Author: User
PHP gets the specified number of cell contents of the specified array in a random array
I can show it randomly in a local apmserv 5.2.6 environment, but when I upload to American space, it shows the number 5, not random. How should I change my advice? Or what function can be used to replace the implementation of random?
  1. $numbers = range (1, 100); Range is to list 1 to 100 as an array
  2. $result = Array_rand ($numbers, 100); Array_rand the specified number of cells in an array in random order
  3. echo $result [5]; Gets the specified number of cells in the array randomly fetched
  4. ?>
Copy Code
  • Related Article

    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.