Re: \n and <br>
| From: | Rolf Brusletto | Date: | Tue, 11 Nov 2003 01:23:34 +0000 |
| Subject: | Re: \n and <br> | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169108@lists.php.net to get a copy of this message | ||
Eugene Lee wrote:
On Mon, Nov 10, 2003 at 06:57:54AM -0800, Chris Shiflett wrote: : : --- PHPLover <phplover@hotmail.com> wrote: : > : > is \n same as <br> : : This is not true. : : > I know that \n creates a break in source and not in display. : > Is it possible to make \n does the same function as <br> : : No, but you can convert your newlines to the HTML equivalent: : : http://www.php.net/nl2br Warning: nl2br() is not safe because it emits "<br />" tags which do not always work on all browsers (especially browsers not explicitly advertised to be XHTML-compliant). If that is the case and you would not like the xhtml compliancy, then just do a str_replace('<br />','<br>',$data); after you do the nl2br, everything cured :)Rolf Brusletto http://www.phpExamples.net