I want an easy way to remove $ badwords elements from $ keywords.
What I have (as an example)
$keywords = array('sebastian','nous','helene','lol'); //it could be anything in fact $badwords = array('nous', 'lol', 'ene', 'seba'); //array full of stop words that I won't write here $filtered_keywords = array_filter(preg_replace($badwords,'',$keywords), 'strlen'); print_r($filtered_keywords);
What i expected
Array ( [0] => samaha [1] => helene )
What i got
Sweet nothing :)
I tried using str_ireplace , but it went wrong because it was being replaced inside strings in my array.
source share