note 10065 modified in nl2br by zak
| From: | zak@php.net | Date: | Sat, 30 Dec 2000 00:13:19 +0000 |
| Subject: | note 10065 modified in nl2br by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9231@lists.php.net to get a copy of this message | ||
[Editor's Note: Each major operating system uses a different character or set of characters to
indicate the end of a line.
Macintosh: \r
Unix : \n
Windows : \r\n
The code below allows the line endings to be easily replaced with a br tag on any of the three major
OSs.
-zak@php.net]
Well, there's some major issues with NewLine codes vs OS (win, linux, mac). Here is what I use
: $s_data = ereg_replace("(\r\n|\n|\r)", "<br />", $s_data);
So far it worked great for me.
Greets, EiGHTRAKS
http://www.php.net/manual/function.nl2br.php