What will be the output of the following PHP code?
<?php
$a = array("A", "Cat", "Dog", "A", "Dog");
print_r(array_count_values($a));
?>
<?php
$a = array("A", "Cat", "Dog", "A", "Dog");
print_r(array_count_values($a));
?>
A. Array ( [A] => 2 [Cat] => 1 [Dog] => 2 )
B. Array ( [A] => 2 [Cat] => 2 [Dog] => 1 )
C. Array ( [A] => 1 [Cat] => 1 [Dog] => 2 )
D. Array ( [A] => 2 [Cat] => 1 [Dog] => 1)
Answer: Option A
Solution(By Examveda Team)
The array_count_values() function counts all the values of an array.Related Questions on Arrays
A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Which function will return true if a variable is an array or false if it is not?
A. this_array()
B. is_array()
C. do_array()
D. in_array()
Join The Discussion