php-arrays function-array_count_values-The number of occurrences of all values in the statistics array _php tutorial

Source: Internet
Author: User
Array_count_values () function

function
The function will return an array,
The array uses the value in the input array as the key name.
The number of occurrences of the value in the input array as a value
"Scope of Use"
PHP4, PHP5
Use
Array array_count_values (array input)
input/Required/counted array
Example
[PHP]
$arr = Array ("Key1" = "Val1", "key2" = "Val2",
"Key3" = "Val1", "Key4" and "Val4");
Print_r (Array_count_values ($arr));
/*
Array
(
[Val1] = 2
[Val2] = 1
[Val4] = 1
)
*/


Excerpts from Zuodefeng's notes

http://www.bkjia.com/PHPjc/478198.html www.bkjia.com true http://www.bkjia.com/PHPjc/478198.html techarticle array_count_values () function "function" The function returns an array that uses the value in the input array as the key name, the number of occurrences in the input array as the value "use fan ...

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