开发者

str_replace not working when text together

开发者 https://www.devze.com 2023-03-23 10:54 出处:网络
This might be a noob question but when I do str_replace(\"<P id=description>\", \"\", $content);

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

精彩评论

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

关注公众号