[ACCEPTED]-PHP, strip_tags stripping \n in text area. How to stop it?-strip-tags
Accepted answer
You can use nl2br
to add the BR
line break element 4 to line break character sequences:
$html = nl2br($plain);
Note that 3 the BR
elements are just added:
nl2br("foo\nbar") === "foo\n<br />bar"
And to prevent 2 strip_tags
to remove P
and BR
tags, specify them in the 1 second parameter:
$clean = strip_tags($html, '<p><br>');
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.