Qua*_*unk 24
我一直在努力,strpos因为它似乎是最快的选择(虽然不知道正则表达式).
if(strpos($haystack, $needle) !== FALSE) return $haystack;
Run Code Online (Sandbox Code Playgroud)
在regexp中你可以写
preg_match_all("/(red|blue|black|white|etc)/", $haystack, $matches);
print_r($matches);
Run Code Online (Sandbox Code Playgroud)
对所有字符串使用循环,您将很容易注意到您需要的$匹配值.