Is there any function to find repeated value in an array?
What is w2 standard



Is there any function to find repeated value in an array? What is w2 standard..

Answer / amitverma

Yes, there's a function for everything in PHP :)
To see the repeated values in an array you may use function
array_count_values($array);

This function will return you an array, consisting each
vaule's frequency associated with it.


##
#Following Code -

$array = array(1, "hello", 1, "world", "hello");
print_r(array_count_values($array));

##
#Outputs -

Array
(
[1] => 2
[hello] => 2
[world] => 1
)

Is This Answer Correct ?    11 Yes 3 No

Post New Answer

More PHP Interview Questions

Which is a perfect example of runtime polymorphism?

0 Answers  


Explain me what are the main error types in php and how do they differ?

0 Answers  


Is php is dying?

0 Answers  


How to call a php function from html button?

0 Answers  


Tell me which programming language does php resemble to?

0 Answers  






How can we know that a session is started or not?

3 Answers   Rushmore Consultancy,


How to find a specific value in an array?

0 Answers  


Write a program to get lcm of two numbers using php?

0 Answers  


What is the use of post in php?

0 Answers  


How to read a file in php?

0 Answers  


How is php different from other languages?

0 Answers  


Tell me what is the use of isset() in php?

0 Answers  


Categories