I want to compare array of words with a field of database table which contains more than 2000 entries. For example user input a string "this is good" It will explode the string into array and than match the words with the database table , such as good exists in the table then it will return the good keyword. here is my code
$cmnt = $request['comment'];
$parse = explode(' ',$cmnt);
$length = count($parse);
for($i = 0; $i < $length ; $i++)
{
$keyword = Rate::where('keyword',$parse[$i]);
}
if ($keyword != null)
{
dd($keyword);
}
