Core Function CountValues

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
UberFoX (Talk | contribs)
(Created page with "<pre> CountValues( <array> ) </pre> === Description === Counts all the values of an array. Returns an array using the values of the input array as keys and their frequency in...")
Newer edit →

Revision as of 10:01, 31 August 2013

CountValues( <array> )

Contents

Description

Counts all the values of an array.

Returns an array using the values of the input array as keys and their frequency in input as values.

Parameters

array

The array to use.

Return Value

Success: new array

Failure: empty array

Remarks

None.

Example

$array = array(1, "hello", 1, "world", "hello");
printr(CountValues($array));
/*
// Prints
ARRAY
{
        [1] => 2
        [hello] => 2
        [world] => 1
}
*/
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox