Php 我可以使用什么算法来解决这种情况(字符串匹配/单词匹配)?

Php 我可以使用什么算法来解决这种情况(字符串匹配/单词匹配)?,php,arrays,algorithm,matching,Php,Arrays,Algorithm,Matching,我想为我的小论文项目建立一个网络论坛。系统将像这样工作 “问题/讨论将与tb_关键字中存在的关键字匹配,如果找到2个或更多匹配的单词, 问题/讨论将发送到tb_post”。我试图用蛮力算法解决这个问题,但它不起作用。我将数据从输入转换为数组和tb_关键字中的关键字。 我可以用什么算法来解决这个问题 示例: 输入:metode或算法可以解决这个问题吗 tb\u关键字 | id | keyword | -------------------- | 1. | method | | 2

我想为我的小论文项目建立一个网络论坛。系统将像这样工作 “问题/讨论将与tb_关键字中存在的关键字匹配,如果找到2个或更多匹配的单词, 问题/讨论将发送到tb_post”。我试图用蛮力算法解决这个问题,但它不起作用。我将数据从输入转换为数组和tb_关键字中的关键字。 我可以用什么算法来解决这个问题

示例:

输入:metode或算法可以解决这个问题吗

tb\u关键字

| id |   keyword   |
--------------------
| 1. |   method    |
| 2. |  algorithm  |
| 3. |  experiment |
如何制作它们可以这样比较:

method[0]=> method[1] = matched => 1 matched
or[1] =>method[1] = didn't match
or[1]=>algorithm[2]=didin't match
or[1]=>experiment[3]=didin't match
algorithm[2]=> method[1] =didin't match
algorithm[2]=> algorithm[2] =matched => 1 matched
can[3] =>method[1] = didn't match
can[3]=>algorithm[2]=didin't match
can[3]=>experiment[3]=didin't match
solve[4] =>method[1] = didn't match
solve[4]=>algorithm[2]=didin't match
solve[4]=>experiment[3]=didin't match
this[5] =>method[1] = didn't match
this[5]=>algorithm[2]=didin't match
this[5]=>experiment[3]=didin't match
problem[6] =>method[1] = didn't match
problem[6]=>algorithm[2]=didin't match
problem[6]=>experiment[3]=didin't match

count(matched) = 2
在那个例子中,metode和算法存在于tb_关键字中,所以它将被发送到tb_post中