Forum Moderators: coopster
<?
$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.
Is there a reverse of nl2br in php?
---
This is the current top hit on google for search string "reverse of nl2br"
[webmasterworld.com...]
And it was closed yesterday for replies since it was to old.
btw, here is another solution
$str = str_replace('<br />', "\n", $str);
welcome,
K
$str = str_replace(array('<br />', '<br>'), "\n", $str);
Should be the best solution without using regex, thanks Ron.