开发者

str_replace not working when text together

This might be a noob question but when I do

str_replace("<P id=description>", "", $content);

this is part of the $content <P id=description>ஈழ but I cannot get rid of this, and I 开发者_高级运维get the same problem when i try to replace the ம்</P> using str_replace("</P>", " ", $content); but it works when the </P> has space in between, and when I try preg_match_all "'<(.*?)>'si"; i dont get those tags.


When you are working with multibyte strings you might want to use functions that are for multibyte strings, like mb_ereg_replace.


strings has to match!

$content = '<P id=eow-description>ஈழ';
str_replace("<P id=eow-description>", "", $content);

will work...


Based on your comments use strip_tags() (linked) to remove all the HTML from the document.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜