title: PHP - Getting rid of curly apostrophes
body: <p>I'm trying to get rid of curly apostrophes (ones pasted from some sort of rich text doc, I imagine) and I seem to be hitting a road block.  The code below isn't working for me.</p>
  
  <pre><code>$word = "Today’s";
  $search = array('&amp;#8222;', '&amp;#8220;', '&amp;#146;');
  $replace = array('"', '"', "'");
  $word = str_replace($search, $replace, htmlentities($word, ENT_QUOTES));
  
  What I end up with is $word containing 'Today&amp;#146;s'.
  </code></pre>
  
  <p>When I remove the ampersands from my $search array, the replace takes place but this, obviously, will not get the job done since the ampersand is left in the string.  Why is str_replace failing when it comes across the ampersands?</p>