Re: Print '\n' not working
| From: | Chris Shiflett | Date: | Wed, 25 Jun 2003 17:36:26 +0000 |
| Subject: | Re: Print '\n' not working | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152836@lists.php.net to get a copy of this message | ||
--- Koch-1 Linda <Linda.M.Koch@nasa.gov> wrote:
> I am using PHP 4, Apache, but the '\n' is not going to the next
> line during a print.
There are probably two issues here. One is that anything in single quotes gets
translate literally, so '\n' will output \n whereas "\n" will output a newline
character.
The other issue is that newlines are not interpreted by browsers unless
something like the <pre> tag is used or the content type is plain text. In the
case of HTML documents, you need a <br> (or <br /> for XHTML). There is a PHP
function that can help with this, nl2br().
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/