R
R
Ruslan Tyulyukin2016-05-31 23:04:32
PHP
Ruslan Tyulyukin, 2016-05-31 23:04:32

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

2 answer(s)
A
Alexey, 2016-05-31
@alsopub

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.

V
Vovka Solovyov, 2015-09-10
@vovkasolovev

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 question

Ask a Question

731 491 924 answers to any question