You could try a array_intersect
or Collection's intersect
to get the values they have that are the same.
array_intersect($a, $b); // return the values that are the same between them
$collection->intersect($b);
Laravel Docs - Collections - intersect
Potentially you can do this from the query if you just want a count of them.
$matchingAnswers = Answer::whereIn('ans', $answer)->count();
Thank you lagbox it's working fine and thank you again for quick response
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community