Re: PHP EOL

From: Date: Sat, 02 Jul 2011 08:17:31 +0000
Subject: Re: PHP EOL
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-313837@lists.php.net to get a copy of this message
On Jul 2, 2011, at 3:10 AM, viraj wrote:
PHP_EOL is the best fit. you do not have to write multiple lines of code to do the same thing. ~viraj p.s. cross-posting is bad. removed db. from the cc list. On Sat, Jul 2, 2011 at 1:31 PM, Karl DeSaulniers <karl@designdrumm.com> 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. ;) Karl DeSaulniers Design Drumm http://designdrumm.com
Oops sory for the cross post. Didn't realize that's what that was. I have seen others do it in the past. I am a bit of a list novice. Wont happen again. Thanks for your reply. Karl DeSaulniers Design Drumm http://designdrumm.com

« previous php.general (#313837) next »