David T-G wrote:
Marek, et al --

...and then Marek Kilimajer said...
% % $string = str_replace("\n", '<br>', $string);


That didn't work for me.  Interestingly enough, in light of Leif's post,
neither did \r\n in the search pattern.  Hmmph.  Well, thank heavens once
again for preg_replace() :-)


Thanks & HAND


:-D

Right, I did not think about dos (\r\n) newlines. But Leif's code does not consider mac newlines (\r) :-). This takes care of all:


$string = str_replace(array("\r\n","\n","\r"), '<br>', $string);

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to