I am trying to check if domain name contain blacklisted words.Below is my code so far
function teststringforbadwords($string,$banned_words) {
foreach($banned_words as $banned_word) {
if(stristr($string,$banned_word)){
return false;
}
}
return true;
}
$banned_words= array("casino","payday","prescription");
if (teststringforbadwords("casino123.com",$banned_words)) {
echo "banned word found";
continue;
}
Above code works for casino.com
but not casino123.com
, Any help will be appreciated.
Note : this is not duplicate The question mentioned just check for 1 word , I am checking array of words here.