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
Can you explain, when to use if-else if-else over switch statements?
How can we display information of a variable and readable by a human with php?
Explain the advantages of using PHP?
What is the meaning of symbol '$' in jquery?
What are sql functions?
How to call php function from javascript using ajax?
What is the difference between laravel and php?
Is php dead 2019?
What is php date function?
What is an anti csrf token?
Name some of the constants in php and their purpose.
Is php better than java?
What should be the length of variable for SHA256?
What changes I have to do in php.ini file for file uploading?
How could I install codeignitor ?