Is there any function to find repeated value in an array?
What is w2 standard
Answer Posted / 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 View All Answers
How to remove a file?
Which function can be used to delete a file?
How can we automatically escape incoming data?
Can you convert php to html?
What is if isset ($_ post submit )) in php?
What is csrf token and why it is required?
Tell us what does $_cookie means?
I need to know about the courses which are useful in corporate companies.. especially php/mySQL, Java/j2ee, .NET.. also tell if any other courses are valuable
What is php static function?
Describe session in php.
Which is variable cost?
What is the difference between the functions strstr() and stristr()?
How to replace a substring in a given string?
How to split a string into array using php?
What is the use of imagetypes() method?