SN1P3R_85 Posted March 22, 2009 Share Posted March 22, 2009 I am having a problem with a php script. I want it take the text, and convert all the html tags into literal text. By this i mean if i have a string: <?php $str = "hello<br /><br />hello" ?> I want it to print to the screen as hello<br /><br />hello. My script automatically prints it as an html entity, so it will actually do a line break in the string container. However, my script detects line breaks in the php and puts <br /> in, so I need to somehow take the string, convert it to straight text, then be able to still add html, and have it display as html. Thanks, SN1P3R_85 Link to comment https://forums.phpfreaks.com/topic/150631-solved-php-render-html-as-text-problem/ Share on other sites More sharing options...
Yesideez Posted March 22, 2009 Share Posted March 22, 2009 echo htmlentities($txt); Link to comment https://forums.phpfreaks.com/topic/150631-solved-php-render-html-as-text-problem/#findComment-791278 Share on other sites More sharing options...
SN1P3R_85 Posted March 22, 2009 Author Share Posted March 22, 2009 Thanks alot man, it worked. Link to comment https://forums.phpfreaks.com/topic/150631-solved-php-render-html-as-text-problem/#findComment-791285 Share on other sites More sharing options...
Yesideez Posted March 22, 2009 Share Posted March 22, 2009 Check out the manual on php.net for use of how to maybe tweak it if you need to. http://uk2.php.net/htmlentities Link to comment https://forums.phpfreaks.com/topic/150631-solved-php-render-html-as-text-problem/#findComment-791288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.