So I am trying to make a whitelist in this form to only allow certain words like "clean,broom, mop, etc" and replace everything else with a "*" but I can't seem to figure out how to do it with whitelist I have it working with a blacklist, but I'd rather a white list, this is what I have code wise so far.
$blacklist = array("swear1", "swear2", "swear3");
$value2 = $_POST['chore'];
$value3 = str_replace($blacklist,"*", $value2);
print("$value3");
$arr=array("sweep", "mop", "vaccum");
$val=$_POST['chore'];
if(in_array($val, $arr)){
do whatever you want
}else
{
do whatever you want ex: assign * here
}