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
https://forums.phpfreaks.com/topic/212883-using-a-newline-character/
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.

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>.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.