note 40030 added to function.nl2br
| From: | mark dot terry at emailsmart dot co dot uk | Date: | Thu, 19 Feb 2004 13:05:27 +0000 |
| Subject: | note 40030 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65379@lists.php.net to get a copy of this message | ||
I wanted to replace a UNIX newline with a literal "\n", I used this code.
$string = str_replace("\n", '\\\\n', $string); //escape new lines
For some reason I had to escape the "\" twice, but it works.
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40030
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40030&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40030&report=yes
Search -- http://master.php.net/manage/user-notes.php