我想测试一个字符串,看它包含某些单词.
即:
$string = "The rain in spain is certain as the dry on the plain is over and it is not clear"; preg_match('`\brain\b`',$string);
但该方法只匹配一个单词.如何检查多个单词?
就像是:
preg_match_all('#\b(rain|dry|clear)\b#',$string,$matches);