Support the ongoing development of Laravel.io →
Database Eloquent Configuration
Last updated 1 year ago.
0
Solution

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

PHP - array_intersect

Potentially you can do this from the query if you just want a count of them.

$matchingAnswers = Answer::whereIn('ans', $answer)->count();
Last updated 7 years ago.
0

Thank you lagbox it's working fine and thank you again for quick response

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.