I am looking for the best br2nl function. I would like to replace all instances of and
You should be using PHP_EOL constant to have platform independent newlines.
In my opinion, using non-regexp functions whenever possible makes the code more readable.
$newlineTags = array(
'
',
'
',
'
',
);
$html = str_replace($newlineTags, PHP_EOL, $html);
I am aware this solution has some flaws, but wanted to share my insights still.