Array Count Values Function in PHP

In this article I explain the PHP array_count_values function.
  • 1514

Introduction

The array_count_values() function returns an array using the value of the input array and counts array's values is the number of occurence.

Syntax

array_count_values (array)

Parameter in array_count_values function

It takes one parameter; it is:

Parameter Description
array It specifying an array.

Example of array_count_values function

<?php

$array=array("bye", "hello", 1, "world", "hello",1);

echo "<pre>";

print_r(array_count_values($array));

?>

Output

array-count-values-function-in-php.jpg

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.