Jump to content

what the "\n" means?


co.ador

Recommended Posts

<br /> is a HTML, which will make things you can see in the page start a new line.

 

 

However if the text isn't formatted (and is a plain text file or the source of the HTML file) \n will start a new line with no characters visible.

 

so:

 

echo "<b>Test</b>\n<i>Hello!</i>"

 

Would print out:

 

Testhello

 

But the source of the file, would print:

 

<b>Test</b>
<i>Hello!</i>

 

Wheras:

 

echo "<b>Test</b><br /><i>Hello!</i>"

 

Would print:

 

Test

Hello!

 

But the source code would be:

 

<b>Test</b><br /><i>Hello!</i>

Link to comment
Share on other sites

So it means a new line in source but no in the browser display.

 

I see a lots of codes using this "\n" but really still battling for the real usage and meaning I understood some of what you said but can't related to a real live usage.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.