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

What types of loops exist in php?

0 Answers  


Explain me what is the difference between explode() and split() functions?

0 Answers  


Name and explain five of the PHP error constants?

0 Answers  


What is PHP? Who is the father or inventor of PHP?

0 Answers  


What is htaccess in php?

0 Answers  






What is an associative array?

0 Answers  


Hello Friends,I am seeking for a job in php having 2yrs. exp.Please suggest any company openings.

1 Answers  


What are the different opening and closing tags available in PHP?

0 Answers  


What does the php error 'parse error in php - unexpected t_variable at line x' means?

0 Answers  


What kind of variable is age?

0 Answers  


What is inheritance in php?

0 Answers  


why we used type-pool SLIS in ALVs? how many types of windows in scripts?

0 Answers   IBM,


Categories