note 40030 deleted from function.nl2br by nlopess
| From: | nlopess@php.net | Date: | Thu, 19 Feb 2004 13:37:50 +0000 |
| Subject: | note 40030 deleted from function.nl2br by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65386@lists.php.net to get a copy of this message | ||
Note Submitter: mark.terry@emailsmart.co.uk
----
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.