5
My question is this::
I have the following array:
$array = array(10, 30, 10, 40, 40);
I would like to know if there is a simple way to display the message: "there are duplicate values" or "there are no duplicate values".
The function array_count_values()
could handle this array along with the foreach()
comparing result to result until finding a quantity greater than 1. However, I would like to escape from this analysis, because I just need to know if duplicate values occur and not what these values are. Would anyone have any other idea?
Do you want to know if there are duplicate values on Aray or which one knows which duplicate values? For the first scenario the solution of @bfavaretto is perfect, for the second scenario the Idea was really useful
array_count_values()
with aforeach()
– Erlon Charles