note 57815 added to function.nl2br
| From: | nanoatmydomain dot com at osu1 dot php dot net | Date: | Fri, 14 Oct 2005 23:42:28 +0000 |
| Subject: | note 57815 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-97041@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57815
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57815&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57815&report=yes
Search -- http://master.php.net/manage/user-notes.php