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 |
What is singleton class in php?
How to remove duplicate values from php array?
What is the purpose of the php empty function?
Tell me what's the difference between include and require?
How to make database connection in php?
What does mysqli_query return?
Why do we use interface in php?
What will the ?getdate() function returns in PHP?
Does wordpress run on php 7?
What type of language is php?
How does csrf attack work?
How to redirect a url from http to https in .htaccess?