Forum Moderators: coopster
Then I realized that there's no need to do that if you don't add nl2br() before you store since MySQL is keeping the \n intact. Meaning, when you read the values from the DB THEN add the nl2br().
If this is not really your problem - I think there is no function that reverses nl2br()
Greets
Maybe you should store the articles in the db as they are and without replacing of \n with <br />. It might be better to do the replacements right before the output for reading on your site. In the meantime you can edit the articles without change and change back.
Otherwise you could use this to replace the html breaks with - nothing: str_replace ("<br />", "", $article);
Maybe you have to escape the / in <br /> to <br \/>. Just test it ;-)
NN
Andreas
<?
$string = "Hello <br /><br /><br /><br /> Hello again";
$string = str_replace("<br />","
",$string);
?>
...or to make a more generic regex ofcourse with \n \r and a fluffy acceptance of both <br /> and <br>
Use of this is for example in forms, textareas.