Im trying to build a function that checks to see if a string contains a bad word
function is_approp_input($string) {
$bad_words = array('bad1','bad2','bad3','bad4');
if(in_array($string,$bad_words)) {
return false;
} else {
return true;
}
}
Now if i had the string $string = "bad1ishere";
For some reason, this function will return true, not finding bad1 in the string. It should be returning false.
I probably am doing somthing wrong, so please advise.