我有一个字符串:
$data = "String contains works like apples, peaches, banana, bananashake, appletart";
我还有 2 个包含多个单词的 std 数组,如下所示:
$profanityTextAllowedArray = array();
$profanityTextNotAllowedArray = array();
例如:
$profanityTextAllowedArray
(
[0] => apples
[1] => kiwi
[2] => mango
[3] => pineapple
)
如何获取字符串$data
并首先从中删除任何单词$profanityTextAllowedArray
,然后检查字符串中应标记$data
的任何单词?$profanityTextNotAllowedArray