OK.. I want to loop through a text file and see if any of the words are in a string I pass in seperatley. For example. The text file will look like this.
badWord1
badWord2
badWord3
I dont want to use stristr cause the words have to be whole.
Everything works fine when I do an isolated test, however when I start looping through the text file I get a Warning: Unknown modifier 'c' error.
The Error is Happening With This Line:
if (preg_match("/\b$buffer2\b/i", $name)) return $valid;
Here is what my code looks like:
function checkDataBlacklist( $email, $name, $add1, $city )
{
$valid="yes";
$file2 = "slot2BlackList.txt";
$FileHandle2 = fopen($file2, "r");
while (!feof ($FileHandle2))
{
$buffer = fgets($FileHandle2, 200);
$buffer2 = trim($buffer);
if (preg_match("/\b$buffer2\b/i", $name)) return $valid;
}
}
Thanks in advance for the help...