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
What is difference between post and put in rest?
What are the types of variables in php?
What is trim function in php?
How do you count numbers in php?
What is the difference between pop3 IMAP and MAPI?
Whether php supports microsoft sql server?
How to know user has read the email-php?
Is php worth learning in 2019?
Tell me how to get the value of current session id?
What is die in php?
How to get the length of string?
What is abstract class php?
What is the meaning of a final class and a final method?
How do I clear my browser session?
What function should you use to join array elements with a glue string?