|
|
#1 |
|
Silver Member
![]() Join Date: Aug 2011
Location: Tennessee
Posts: 112
|
What's the difference in using <br> and \n at the end of an echo statement.
|
|
|
|
|
|
#2 |
|
Silver Member
![]() Join Date: Jul 2011
Posts: 146
|
<br> is more correctly <br /> per latest HTML standards and causes a line break in the web page as presented by the browser, or when printed.
\n outputs is a new line character which is interpreted as white space and ignored by the browser, but is meaningful in text and source code files. Placing \n at the end of your echo strings will change your browser's display of source code from this: HTML Code:
select name="select"><option value="A">A</option><option value="B">B</option><option value="C">C</option><option value="D">D</option></select> HTML Code:
<select name="select"> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> <option value="D">D</option> </select> |
|
|
|
|
|
#3 |
|
Bronze Member
![]() Join Date: Feb 2010
Location: Satellite-Town, Lagos, Nigeria, West-Africa.
Posts: 89
|
@DesignerBill, @Glenn
I have encountered the same problem with \n. So what i do is that i enclose the <br> tag in my echo statement. |
|
|
|
|
|
#4 |
|
Silver Member
![]() Join Date: Mar 2011
Posts: 231
|
Hmm, that seems to be a likely solution. I'll try it out with mine.
__________________
Custom Web Design for Businesses |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|