title: Strip specific words/phrases from string
body: <p>I want to remove some specific words and phrases from a string and I followed the discussion at <a href="https://stackoverflow.com/questions/9342149/strip-specific-words-from-string">Strip specific words from string</a>.</p>
  
  <p>I have created an array of forbidden words:
  $wordlist = array("bayes", "full", "greater than");</p>
  
  <p>My example string is:</p>
  
  <pre><code>$string= "my bayesian results are full of bayes and greater than anything else";
  </code></pre>
  
  <p>If I apply the following code:</p>
  
  <pre><code>foreach ($wordlist as &amp;$word) {
      $word = '/\b' . preg_quote($word, '/') . '\b/';
  }
  $string = preg_replace($wordlist, '', $string);
  </code></pre>
  
  <p>the result is:
  my bayesian results are of and greater than anything else [removed word: bayes, full]</p>
  
  <p>whereas I want the result to be:
  my results are of and anything else [removed word: bayes, bayesian, full, greater than]</p>
  
  <p>Note that I want that the forbidden word 'bayes' should remove the word 'bayesian' as well. </p>