faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

98 of 133 people (74%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Why does the echo command not give a line break in the browser output for \n?

Mar 2nd, 2000 13:54
Matt Gregory, Okke Tijhuis, madhu Kangara,


The newline passed in an echo or print() is sent to the browser as 
string information, not formatting information.  You need a <BR> tag in 
your code to create a line break in HTML.
You can also use the nl2br(string myoutput) function to turn newlines 
into <BR> tags.
nl2br("......\n");.