why don't you just use the nl2br() function?
----- Original Message -----
From: "Tom Kincaid" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 01, 2002 9:11 AM
Subject: [PHP] problems with replacing line breaks
> I'm trying to replace line breaks with html code and am having problems.
> single lines preg_replace("/\n/","<br>",$text) or
> ereg_replace("\n","<br>",$text) adds the <br> but doesn't remove the line
> break. While preg_replace("/\n\n/","<p>",$text) doesn't find any double
> breaks, even though they're there. Why doesn't this work?
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php