note 57815 deleted from function.nl2br by mazzanet
| From: | mazzanet@php.net | Date: | Sat, 15 Oct 2005 08:54:53 +0000 |
| Subject: | note 57815 deleted from function.nl2br by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97057@lists.php.net to get a copy of this message | ||
Note Submitter: nano at mydomain.com
----
The term nl2br (new line 'to' <br />) could be somewhat confusing.
I just tested the nl2br with the folowing function on some data pulled out of a database.
<?php
function parse_str($str)
{
$str = nl2br($str);
$str = str_replace("\\r", '\\r', $str);
$str = str_replace("\\n", '\\n', $str);
echo $str;
}
?>
This is is what the str function parsed to the browser :
This is some
\\r\\nSample Text
\\r\\nTo see what nl2br
\\r\\nDoes with
\\r\\nReturns
\\r\\nAnd
\\r\\nNew lines
It seems that the nl2br funtion just adds a <br /> in front of the \r\n caracters in sted of
replacing them.
Hopes it helpes solving some probs you might have.
Grtz Nano