请允许我说,我有各种各样的坏话:
$badwords = array("one", "two", "three");
随机扼杀:
$string = "some variable text";
如何建立这一周期:
if (one or more items from the $badwords array is found in $string)
echo "sorry bad word found";
else
echo "string contains no bad words";
Example:
if $string = "one fine day" or "one fine day two of us did something"
, user should see sorry bad word found message.
If $string = "fine day"
, user should see string contains no bad words message.
如我所知,你可以从阵列上<代码>preg_match。 任何建议?