Jump to content

Using a newline character


fortnox007

Recommended Posts

HI all, something that keeps bothering me is that i do not fully understand the usefullness of the \n newline character.

When i use  for testing in a string it doesn't show the effect in my browser. Only when I press view source I can see that right after the \n character the code jumps down 1 line. Does anyone know how and when to use it? I have see it with the php mail function, but i don't really understand why they use it.

 

If someone could enlighten me i would be very happy  ::)

Link to comment
Share on other sites

I can give you 1 useful reason for it. You can put Google ads JavaScript code to one line in your php file. But I see no point id using it for sourecode either, since there are things like firebug or how ever they call the same thing in chrome that is not extension and is more usable.

Link to comment
Share on other sites

They're used in mail headers, HTTP headers and almost all other headers to distinguish between each individual header.  Also you'll need them in CSV/text files to distinguish the lines.  A newline character will be rendered in text (text file, text viewer, text email etc.).  In HTML it only applies to the source code which is text.  To generate an HTML line break you'll need <BR>.

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.