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

2011-07-04 Thread Karl DeSaulniers


On Jul 4, 2011, at 2:34 AM, Tim Streater wrote:


On 04 Jul 2011 at 08:01, Stuart Dallas  wrote:

On Mon, Jul 4, 2011 at 7:11 AM, Karl DeSaulniers  
wrote:



Hello Stuart,
After some closer look at the RFC Compliant manuals you suggested,
I have determined that the creator of that code was in fact RFC821
Compliant.
Being that this was a code I found several years ago, RFC822 may  
not have

been in effect.
This being the reason (I believe) that the creator went with a  
check for

System OS when determining the end of line characters to use.
Not substantiated in any way, but that is what it looks like to  
me. I could

stand corrected.



RFC821: Simple Mail Transfer Protocol, dated August 1982 (
http://www.faqs.org/rfcs/rfc821.html)

RFC822: Standard for the Format of ARPA Internet Text Messages,  
dated August

13, 1982 (http://www.faqs.org/rfcs/rfc822.html)


There are more recent RFCs than these. RFC822 was obsoleted by  
RFC2822, for example, which was itself obsoleted by RFC 5322. See  
here:


http://tools.ietf.org/html/rfc5322

I always use this site for looking at RFCs as every line in the  
contents of an RFC is an internal link which makes finding things  
in the RFC rather easier. The following list of RFCs is the set I  
consulted when writing my own email client:


a)  RFC 5034 POP3
b)  RFC 2821 SMTP
c)  RFC 5322 Internet Message Format
d)  RFC 2045, 2046, 2047, 2048, 2049, (MIME), and 2183


--
Cheers  --  Tim

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


Thank you for that Tim!

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP EOL

2011-07-04 Thread Tim Streater
On 04 Jul 2011 at 08:01, Stuart Dallas  wrote: 

> On Mon, Jul 4, 2011 at 7:11 AM, Karl DeSaulniers wrote:
>
>> Hello Stuart,
>> After some closer look at the RFC Compliant manuals you suggested,
>> I have determined that the creator of that code was in fact RFC821
>> Compliant.
>> Being that this was a code I found several years ago, RFC822 may not have
>> been in effect.
>> This being the reason (I believe) that the creator went with a check for
>> System OS when determining the end of line characters to use.
>> Not substantiated in any way, but that is what it looks like to me. I could
>> stand corrected.
>>
>
> RFC821: Simple Mail Transfer Protocol, dated August 1982 (
> http://www.faqs.org/rfcs/rfc821.html)
>
> RFC822: Standard for the Format of ARPA Internet Text Messages, dated August
> 13, 1982 (http://www.faqs.org/rfcs/rfc822.html)

There are more recent RFCs than these. RFC822 was obsoleted by RFC2822, for 
example, which was itself obsoleted by RFC 5322. See here:

http://tools.ietf.org/html/rfc5322

I always use this site for looking at RFCs as every line in the contents of an 
RFC is an internal link which makes finding things in the RFC rather easier. 
The following list of RFCs is the set I consulted when writing my own email 
client:

a)  RFC 5034 POP3
b)  RFC 2821 SMTP
c)  RFC 5322 Internet Message Format
d)  RFC 2045, 2046, 2047, 2048, 2049, (MIME), and 2183


--
Cheers  --  Tim

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

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

2011-07-04 Thread Karl DeSaulniers

@Stuart
Ah, then you are right that they were not compliant. The code is not  
that old.
Thank you so much for the links and information too. Much more than I  
expected.
I did not know that they were sent OS-Independent, but that makes  
perfect sense.

Again, please excuse my lack of understanding.
My thought on why I would still use the code was that even though the  
SMTP server
would not be OS specific, the email program or browser would be and  
that it would format

for the user depending on that program/browser and the OS it runs on.
IE: Thunderbird on PC or Mac Mail; viewing yahoo on Safari Mac or IE  
on PC.


Technically speaking, is it not possible to determine with a if {} to  
see which catches?
This is probably not the best way to go about formating, just more  
for my intuit.
With that code, I did not get any bounce backs or messages pertaining  
to ill formatting or "no send no show".

So it didn't seem to be a bad code. Thus I continued use.
But like what was said earlier in the thread, I agree PHP_EOL would  
be the best fit.


Thank you for all your input, help and resources.

Best,
Karl

On Jul 4, 2011, at 2:01 AM, Stuart Dallas wrote:

On Mon, Jul 4, 2011 at 7:11 AM, Karl DeSaulniers  
wrote:



Hello Stuart,
After some closer look at the RFC Compliant manuals you suggested,
I have determined that the creator of that code was in fact RFC821
Compliant.
Being that this was a code I found several years ago, RFC822 may  
not have

been in effect.
This being the reason (I believe) that the creator went with a  
check for

System OS when determining the end of line characters to use.
Not substantiated in any way, but that is what it looks like to  
me. I could

stand corrected.



RFC821: Simple Mail Transfer Protocol, dated August 1982 (
http://www.faqs.org/rfcs/rfc821.html)

RFC822: Standard for the Format of ARPA Internet Text Messages,  
dated August

13, 1982 (http://www.faqs.org/rfcs/rfc822.html)

So, unless you started using that code before PHP was created (1995  
if we go

back as far as PHP/FI) then no, RFC822 predates that snippet of code.

Further, RFC821 defines the end of lines as CRLF, so the creator of  
that
code was not RFC821 compliant if it was being used to send commands  
to an

SMTP server.

From RFC821, MAIL FROM command definition: MAIL  FROM:path>



From RFC822, general header field definition: field = field-name ":" [
field-body ] CRLF

Note the CRLF at the end of both definitions.

Now, technically speaking the body of email messages can use any line
endings they want to, but the headers should use CRLF, and commands  
sent to

servers should also use CRLF.

One final thing for you to consider... what we've been talking  
about is
commands and messages being sent to other computers, so what good  
does it do
to send them in a format that's dependent on the OS of the sending  
machine?
The standards exist so they are OS-independant, because you usually  
cannot

tell what OS the computer you're talking to is running.

-Stuart

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



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

2011-07-04 Thread Stuart Dallas
On Mon, Jul 4, 2011 at 7:11 AM, Karl DeSaulniers wrote:

> Hello Stuart,
> After some closer look at the RFC Compliant manuals you suggested,
> I have determined that the creator of that code was in fact RFC821
> Compliant.
> Being that this was a code I found several years ago, RFC822 may not have
> been in effect.
> This being the reason (I believe) that the creator went with a check for
> System OS when determining the end of line characters to use.
> Not substantiated in any way, but that is what it looks like to me. I could
> stand corrected.
>

RFC821: Simple Mail Transfer Protocol, dated August 1982 (
http://www.faqs.org/rfcs/rfc821.html)

RFC822: Standard for the Format of ARPA Internet Text Messages, dated August
13, 1982 (http://www.faqs.org/rfcs/rfc822.html)

So, unless you started using that code before PHP was created (1995 if we go
back as far as PHP/FI) then no, RFC822 predates that snippet of code.

Further, RFC821 defines the end of lines as CRLF, so the creator of that
code was not RFC821 compliant if it was being used to send commands to an
SMTP server.

>From RFC821, MAIL FROM command definition: MAIL  FROM:


>From RFC822, general header field definition: field = field-name ":" [
field-body ] CRLF

Note the CRLF at the end of both definitions.

Now, technically speaking the body of email messages can use any line
endings they want to, but the headers should use CRLF, and commands sent to
servers should also use CRLF.

One final thing for you to consider... what we've been talking about is
commands and messages being sent to other computers, so what good does it do
to send them in a format that's dependent on the OS of the sending machine?
The standards exist so they are OS-independant, because you usually cannot
tell what OS the computer you're talking to is running.

-Stuart

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


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

2011-07-03 Thread Karl DeSaulniers

Hello Stuart,
After some closer look at the RFC Compliant manuals you suggested,
I have determined that the creator of that code was in fact RFC821  
Compliant.
Being that this was a code I found several years ago, RFC822 may not  
have been in effect.
This being the reason (I believe) that the creator went with a check  
for System OS when determining the end of line characters to use.
Not substantiated in any way, but that is what it looks like to me. I  
could stand corrected.


Best,
Karl


On Jul 3, 2011, at 6:11 PM, Karl DeSaulniers wrote:


I see. Yes, I was referring to the PHP manual.
I will investigate the RFC manuals as well like you had noted.
No offense taken. Thank you for the clarification.

Best,
Karl


On Jul 3, 2011, at 6:07 PM, Stuart Dallas wrote:

On Sun, Jul 3, 2011 at 11:22 PM, Karl DeSaulniers  
 wrote:

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


I meant no offence, I was simply responding to your comment:   
"Also, It has worked for years with no problem and I would still  
use it" ...and took it to mean you would have no issue with using  
that code, so I thought it worth pointing out that the standards  
exist for a reason.


In the name of clarification, the "manual" I was referring to is  
the sum total of the RFCs that define the various protocols used  
on the internet, not the PHP manual which I believe you think I  
meant.


-Stuart

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



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

2011-07-03 Thread Karl DeSaulniers

I see. Yes, I was referring to the PHP manual.
I will investigate the RFC manuals as well like you had noted.
No offense taken. Thank you for the clarification.

Best,
Karl


On Jul 3, 2011, at 6:07 PM, Stuart Dallas wrote:

On Sun, Jul 3, 2011 at 11:22 PM, Karl DeSaulniers  
 wrote:

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


I meant no offence, I was simply responding to your comment:   
"Also, It has worked for years with no problem and I would still  
use it" ...and took it to mean you would have no issue with using  
that code, so I thought it worth pointing out that the standards  
exist for a reason.


In the name of clarification, the "manual" I was referring to is  
the sum total of the RFCs that define the various protocols used on  
the internet, not the PHP manual which I believe you think I meant.


-Stuart

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com



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

2011-07-03 Thread Stuart Dallas
On Sun, Jul 3, 2011 at 11:22 PM, Karl DeSaulniers wrote:

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

I meant no offence, I was simply responding to your comment:  "Also, It has
worked for years with no problem and I would still use it" ...and took it to
mean you would have no issue with using that code, so I thought it worth
pointing out that the standards exist for a reason.

In the name of clarification, the "manual" I was referring to is the sum
total of the RFCs that define the various protocols used on the internet,
not the PHP manual which I believe you think I meant.

-Stuart

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


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

2011-07-03 Thread Karl DeSaulniers

@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  
wrote:



Hello 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')) {


  $eol="\r\n";



when 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   
wrote:


On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers  

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/



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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




Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP EOL

2011-07-03 Thread Stuart Dallas
On Sun, Jul 3, 2011 at 10:31 PM, Karl DeSaulniers wrote:

> Hello 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')) {
>>
>>>   $eol="\r\n";
>>>
>>
>> when 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  wrote:
>>
>>> On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers >> >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/
>>>
>>>
> Karl DeSaulniers
> Design Drumm
> http://designdrumm.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] PHP EOL

2011-07-03 Thread Karl DeSaulniers

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


Thanks viraj...

Best,
Karl


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')) {

   $eol="\r\n";


when 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  wrote:
On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers  
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/



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Re: [PHP] PHP EOL

2011-07-02 Thread viraj
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')) {
>$eol="\r\n";

when 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  wrote:
> On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers 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



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

2011-07-02 Thread Karl DeSaulniers

Thanks Stuart!

Karl

Sent from losPhone

On Jul 2, 2011, at 8:45 AM, Stuart Dallas  wrote:

On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers  
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



Re: [PHP] PHP EOL

2011-07-02 Thread Stuart Dallas
On Sat, Jul 2, 2011 at 9:01 AM, Karl DeSaulniers 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/


Re: [PHP] PHP EOL

2011-07-02 Thread Karl DeSaulniers

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


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



Re: [PHP] PHP EOL

2011-07-02 Thread viraj
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  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
>
>

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



[PHP] PHP EOL

2011-07-02 Thread Karl DeSaulniers

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