nonexistentera Posted June 18, 2009 Share Posted June 18, 2009 Is there a way to do this. Like if the original string was Great job. Amazing and went through nl2br to become Great job. <br /> Amazing is there anyway to revert back to the original formatting. I guess what Im asking is if there is a way to go from <br /> to \n and showing the string in it's original form of Great job. Amazing I was thinking of preg_match or something along the lines of that. Link to comment https://forums.phpfreaks.com/topic/162700-filter-out-added-from-nl2br-for-simple-editing/ Share on other sites More sharing options...
Ken2k7 Posted June 18, 2009 Share Posted June 18, 2009 str_replace('<br />',"\n",$str); Link to comment https://forums.phpfreaks.com/topic/162700-filter-out-added-from-nl2br-for-simple-editing/#findComment-858639 Share on other sites More sharing options...
akitchin Posted June 18, 2009 Share Posted June 18, 2009 str_replace('<br />',"\n",$str); that's actually going to leave you with double line-breaks, since nl2br() adds an end-of-line with each <br /> tag. Link to comment https://forums.phpfreaks.com/topic/162700-filter-out-added-from-nl2br-for-simple-editing/#findComment-858648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.