Answer the question
In order to leave comments, you need to log in
How to remove implicit duplicates in php array?
There is an array of strings, some of which can be implicit duplicates of each other, for example: "aspen leaf" and "aspen leaf". Those. the same words, but in a different order. The task is to remove such implicit duplicates. Now I'm thinking of doing:
1. Create an associated array, where there will be a "string" => "string, where the words are sorted alphabetically"
2. Remove duplicates by the values of the associated array
3. Create a simple array from the keys of the cleared array.
Actually, two questions - can it be done easier? If not, then how to remove duplicates by key/value in the associated array? I only know array_unique, but it is not suitable for this.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question