phool4fool
203.***.***.***
array_count_values
Description:
Counts all the values of an array
PHP Example:
0<?
1$array = array(1, "hello", 1, "world", "hello");
2
3print_r(array_count_values($array));
4
5?>
Usage Example:
0<?
1
2$array = array(1, "hello", 1, "world", "hello");
3
4print_r(array_count_values($array));
5
6/*
7it will give the following output
8
9Array
10(
11 [1] => 2 // two times 1 int
12 [hello] => 2 // two times hellow string
13 [world] => 1 // one time world string
14)
15
16*/
17?>
phool4fool;301:
Description:
Counts all the values of an array
PHP Example:
0<?
1$array = array(1, "hello", 1, "world", "hello");
2
3print_r(array_count_values($array));
4
5?>
Usage Example:
0<?
1
2$array = array(1, "hello", 1, "world", "hello");
3
4print_r(array_count_values($array));
5
6/*
7it will give the following output
8
9Array
10(
11 [1] => 2 // two times 1 int
12 [hello] => 2 // two times hellow string
13 [world] => 1 // one time world string
14)
15
16*/
17?>
I usually use foreach loops in other langauges as i think there is no use of havinfg total count of elements in an array rather than we need to do something with in which !
so in this case it will be good for using some loop to iterate elements