开发者

Removing/Replacing ” from string [duplicate]

开发者 https://www.devze.com 2023-03-10 18:12 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to decode numeric HTML entities in PHP
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to decode numeric HTML entities in PHP

How does one remove/replace ” characters from a string?

I've tried html_entity_decode but it don't seem to work. There are other similar characters in the string that don't seem t开发者_Go百科o be converted or removed.

Any ideas?


The issue is that html_entity_decode() doesn't translate numeric entities.

I added an answer to the suggested duplicate How to decode numeric HTML entities in PHP


str_replace(array('”', '”'), '', $thestring);

Here is a working example: http://codepad.org/gXrZcxaF


Does this do what you're looking for:

  • http://shiflett.org/blog/2005/oct/convert-smart-quotes-with-php Converting smart quotes and other characters with PHP so they display correctly
  • http://ca2.php.net/manual/en/function.htmlentities.php#84612 Dealing with Numeric entities in PHP (comment on the manual)
0

精彩评论

暂无评论...
验证码 换一张
取 消