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 are the method available in form submitting?
What does explode do in php?
How long does a session last in php?
What is difference between isset and empty in php?
Is age interval or ordinal?
How to remove blank spaces from the string?
How send email using php?
How could I install codeignitor ?
What is the use of nl2br() in php?
What are the steps involved to run php?
What is asort php?
Differences between get, post and request methods ?
How does php server work?
How big is nvarchar max?
What is the difference between get and post method in php?