I'm setting up a php mail sending script...
While adding different headers, I've come across the symbol for a new line in the email (since a < br > tag won't do)...
So my question is what is the difference between and ?
for example:
echo $var1 . "
" . $var2 . "
";
thanks for your help!
means carriage return and
means new line. Its easier to think about it like a type writer, the
is when you push the paper holder (maybe it is called a carriage???) from the left to right, so you can type at the beginning of the line, and the
will lower the line by one. Traditionally windows and windows based programs required both, but most programs now recognize
as a new line for all operating systems.
is a new line and is a carriage return.
http://en.wikipedia.org/wiki/Newline#In_programming_languages
is a new line in windows and
would be two new lines on UNIX like systems.
Don't confuse a new line with a line break, which exists in HTML. It's basically just a new line you would see in a plain text file but not in browsers.
See Newline
Actually is the windows standard for a single line break. The unix standard is a single character.
Mostly (in emails) you can ignore the character and only use for a single line break. Which also means that represents a double line break.
carriage return moves the input position back to the beginning. Then
advances to the new line.
" "
is primarily used in DOS, while in UNIX it is express in " "
. So if you interpret " "
in UNIX it will be equivalent to two line break. Since you mention PHP, it's safe to use PHP predefined constant PHP_EOL
.
is the standard.
From RFC 2822
Messages are divided into lines of characters. A line is a series of characters that is delimited with the two characters carriage-return and line-feed; that is, the carriage return (CR) character (ASCII value 13) followed immediately by the line feed (LF) character (ASCII value 10). (The carriage-return/line-feed pair is usually written in this document as "CRLF".)
The other is just 2 lines.
If this is the email headers I believe it would be
echo $var1 . "
" . $var2 . "
";
Here is the delimiter of header and body. It could be HTTP or SMTP