note 49516 modified in function.nl2br by thiago
| From: | thiago@php.net | Date: | Thu, 05 Mar 2009 12:21:55 +0000 |
| Subject: | note 49516 modified in function.nl2br by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151520@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:
<?php
$Result = str_replace( "\n", '<br />', $Text );
?>
--was--
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 );
http://php.net/manual/en/function.nl2br.php