Array Count Values Function in PHP

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

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

© 2019 DotNetHeaven. All rights reserved.