Answer the question
In order to leave comments, you need to log in
Finding similarities in arrays. How to decide?
Hello everyone, I've run into a problem. It needs to be done in PHP. There are 5 arrays and it is required in 4 arrays to find a match by values and in which array there are the most matches, display the array number or any field from this array. I can't figure it out, please help. And yes, I'm still new to this difficult business :)
Answer the question
In order to leave comments, you need to log in
You need the array_intersect function, read the documentation, then everything is simple.
array_intersect returns an array, count counts the number of elements.
Next, choose where there are more matches.
I won’t suggest a ready-made solution, but if no one else advises, look at how it was implemented on the site that we once made, with a similar twist, on jQuery. Only there without arrows:
lalubie.podhod.ru
(Practice has shown, by the way, that not everyone quickly understands this element).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question