PHP check if 2 words given

PHP
if(preg_match('(bad|naughty)', $data) === 1) { } 
Source

Also in PHP: