开发者

PHP convert double quoted string to single quoted literal string

Is there a way to convert the double quoted string "<b>foo</b>" to the single quoted string '<b>foo</b>'. Please note that I cannot use <?php strip_tags("<b>foo</b>")?>, I need to tags to be present.

EDIT: I should have asked a question, I would like to styling to be removed, I don't wish foo to be boldened - just for <b>foo</b> to be echo'd to the screen.

Solution found: For anyone intere开发者_开发技巧sted: htmlspecialchars does the job.

Cheers, Kay


Unless I misunderstood, would a simple string substitution work?

str_replace('"', "'", '"<b>foo</b>"'); //'<b>foo</b>'
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜