Randomly extracting one or more cell methods from an array _php tutorial

Source: Internet
Author: User
By randomly extracting one or more cell methods from an array, we use Array_rand (), which is useful when you want to remove one or more random cells from an array. It accepts input as an input array and an optional parameter, Num_req, indicating how many units you want to remove-if not specified, the default is 1. If you only take one, Array_rand () returns the key name of a random cell, or returns an array containing a random key name

$a =array ("a" = "dog", "b" = "Cat", "C" and "Horse");
Print_r (Array_rand ($a, 1));
?>

http://www.bkjia.com/PHPjc/445354.html www.bkjia.com true http://www.bkjia.com/PHPjc/445354.html techarticle by randomly extracting one or more cell methods from an array, we use Array_rand (), which is useful when you want to remove one or more random cells from an array. It accepts input as input number ...

  • 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.