Re: [PHP-DB] Re: [PHP] PHP EOL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Stuart!

Karl

Sent from losPhone

On Jul 2, 2011, at 8:45 AM, Stuart Dallas <stuart@xxxxxxxx> wrote:

On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers <karl@xxxxxxxxxxxxxxx>wrote:

Hello All,
Happy pre independence for my American PHPers. And good health to all
others.
Have a quick question..

I have this code I use for the end of line characters used in my mailers.

[Code]
// Is the OS Windows or Mac or Linux
if (strtoupper(substr(PHP_OS,0,5)**=='WIN')) {
      $eol="\r\n";
} else if (strtoupper(substr(PHP_OS,0,5)**=='MAC')) {
      $eol="\r";
} else {
      $eol="\n";
}
[End Code]

Does this suffice or should I be using the php supplied end of line?

$eol=PHP_EOL;

Or do these do the same thing?
What advantages over the code I use does the PHP_EOL have?
Or does it not matter with these and either are good to go?

It seems to me that they do the same thing.. am I on the right track or
missing something?
Is there any other OS's that are not WIN or MAC and use the "\r" or "\r\n"
?
If their are, then I can see an advantage of using the PHP_EOL.

Like I said, just a quick question. ;)


When you say "mailers" are you talking about emails? If so then you should be using "\r\n" at all times since that's what numerous email- related RFCs specify. If you use anything else then you may find your email gets rejected by strictly implemented mail servers (rare these days, but it happens).

Incidentally, CR only applies to Mac OS9 and earlier. OSX uses LF due to its
BSD roots. For a near-complete list, see "Representations" here:
http://en.wikipedia.org/wiki/Newline.

-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux