Re: Simplest problem

From: Date: Wed, 28 Jun 2000 08:56:30 +0000
Subject: Re: Simplest problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-3520@lists.php.net to get a copy of this message
>Guys I know...that in HTML we use <br> tag to change the line. >But I am referring that \n from a book on php called >Core PHP Programming by Leon Atkinson. >This guy says to use a "\n" Probably just a misunderstanding.. If not.. throw the book out of the window. >Now tell me what is the exact problem. I don't mean to be rude.. But you should tell us really. '\n' - this is a escape character for newline.. It is virtually the same thing as pressing enter in notepad. if you would write something like this in notepad: ---8<--- <html> <body> line 1 line 2 line 3 </body> <html> ---8<--- it is in code: ---8<--- print("<html>\n"); print(" <body>\n"); print(" line 1\n"); .... ---8<--- All the lines would end up on the SAME line in the browser.. Because the browser parses HTML, and in HTML the newline means NOTHING in a text context (unless it's within the <pre> tags). You have to use the <br> tag for a newline in html. Obviously you have to put a <br> after each line. So really.. In your code you should output both.. for neatness... like print("Line 1<br>\n"); Try running the script through php.exe so that you can view the raw output, it might make it a bit more understandable.

« previous php.general (#3520) next »