note 49516 added to function.nl2br
| From: | CGameProgrammer at gmail dot com | Date: | Mon, 31 Jan 2005 01:28:17 +0000 |
| Subject: | note 49516 added to function.nl2br | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84254@lists.php.net to get a copy of this message | ||
It's important to remember that this function does NOT replace newlines with <br> tags.
Rather, it inserts a <br> tag before each newline, but it still preserves the newlines
themselves! This caused problems for me regarding a function I was writing -- I forgot the newlines
were still being preserved.
If you don't want newlines, do:
$Result = str_replace( "\n", '<br />', $Text );
----
Manual Page -- http://www.php.net/manual/en/function.nl2br.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49516
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49516&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49516&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49516&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49516&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49516&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49516&report=yes
Search -- http://master.php.net/manage/user-notes.php