IT. Expert System.

PHP

Counts all the values of an array


array_count_values

(PHP 4, PHP 5)

array_count_valuesCounts all the values of an array

Description

array array_count_values ( array $input )

array_count_values() returns an array using the values of the input array as keys and their frequency in input as values.

Parameters

input

The array of values to count

Return Values

Returns an associative array of values from input as keys and their count as value.

Errors/Exceptions

Throws E_WARNING for every element which is not string or integer.

Examples

Example #1 array_count_values() example

<?php
$array 
= array(1"hello"1"world""hello");
print_r(array_count_values($array));
?>

The above example will output:

 Array (  [1] => 2  [hello] => 2  [world] => 1 ) 

See Also

  • count() - Count all elements in an array, or something in an object
  • array_unique() - Removes duplicate values from an array
  • array_values() - Return all the values of an array
  • count_chars() - Return information about characters used in a string



Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 505 / 158691944. Delta: 0.02384 с