Re: Re: PHP EOL
| From: | Karl DeSaulniers | Date: | Sun, 03 Jul 2011 22:22:52 +0000 |
| Subject: | Re: Re: PHP EOL | ||
| References: | 1 2 3 4 5 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-313849@lists.php.net to get a copy of this message | ||
@Stuart,
Actually that is what made me look into the PHP_EOL Stuart. Wanting to do things right.
Did you not read my initial email? I am not suggesting anyone adopt my code.
The question was directed to what the differences are so I COULD learn the right way.
Being that this was something I got off a tutorial from an accredited website, your saying that to the wrong person.
I went and read the manuals and am here now posting the question so as to get the right direction.
I have heard the argument and actually agreed. It would be better to use the PHP_EOL instead.
I have been directed in the right direction. So I will be changing my code to reflect.
Thank you,
Best,
Karl
A am going to end this thread here. Since it is getting cross-post responses.
On Jul 3, 2011, at 4:37 PM, Stuart Dallas wrote:
On Sun, Jul 3, 2011 at 10:31 PM, Karl DeSaulniers <karl@designdrumm.com>wrote:Karl DeSaulniers Design Drumm http://designdrumm.comHello All, Just so you know, this is not something I made up myself. It was taken from an online HTML email tutorial. Also, It has worked for years with no problem and I would still use it, however I found out about the PHP_EOL and was just curious as to the difference.You've checked that every single email it has ever sent has been received correctly at the destination mailbox? The internet is built on RFCs, and their general principle is "be strict in what you send and liberal in what you accept" - if it wasn't like that the internet would fall apart. I encourage you to do your part to do things right, but it's completely up to you if you don't want to follow the users' manual. -Stuart --Stuart Dallas 3ft9 Ltd http://3ft9.com/ On Jul 2, 2011, at 8:28 PM, viraj wrote:hi all,looking at the code Karl has posted, this code bit is not going to be a help in setting the 'new line' character in an email body, because it decides based on the server operating system. if (strtoupper(substr(PHP_OS,0,5)****=='WIN')) {Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpwhen sending out emails, the most compatible way is to use "\r\n" as Stuart has pointed out (plain text emails). ~viraj On Sat, Jul 2, 2011 at 7:15 PM, Stuart Dallas <stuart@3ft9.com> wrote:$eol="\r\n";On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers <karl@designdrumm.comwrote: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')) {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<http://en.wikipedia.org/wiki/Newline> . -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.com/$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. ;)