regex - How to check for two words ('goat' and 'sheep') with preg_match in PHP? -
how check 2 words (example 'sheep' , 'goat') preg_match in php?
example:
if (!preg_match(goat|sheep)) header(' location: / ');
thanks!
simply this:
if (!preg_match('~\b(?:goat|sheep)\b~i', $yourstring)) header('location: /');
Comments
Post a Comment