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
Explain the syntax for ‘foreach’ loop with example.
What is the string concatenation operator in php?
Is key in array php?
How many open modes available when a file open in PHP?
What is session and why do we use it?
What is php built on?
What are php loops?
How do you find the length of a string in php?
What is php artisan serve?
Does strlen include null?
What is print_r?
How do I debug php?
What is $this in php?
Is nan in javascript?
Is age nominal or ordinal?