POLL: To add the final ?> or not...

POLL: To add the final ?> or not...

am 08.01.2010 21:24:34 von Daevid Vincent

I'm having a debate with a co-worker about adding the final ?> on a PHP
page...

To be honest, I am the lead, and I could pull rank and be done with the
discussion, however I don't like to be that way. I would rather do the
right thing. If my way of thinking is old-school (I've been coding since
PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
rather adopt that, despite how icky it makes me feel to leave an unclosed
behind"! :)

Is there ANY side-effects to leaving the end ?> off? Is it any more work
for the compiler? And yes I know computers are hella-fast and all that, but
I come from the gaming industry where squeeking out an extra FPS matters,
and shaving off 0.01s per row of data in a table matters if you have more
than 100 rows. A 1 second wait IS noticeable and a 10 second is even moreso
-- just try to talk for 10 seconds straight without a pause. Or sit there
and stare at a screen for 10 seconds!

If the main argument is that it's to prevent white-space after the code,
then most modern editors that I'm aware of will automatically trim
white-space (or have a setting to do so). Plus this is ONLY a factor when
you're trying to output a header and things like that. In 90% of your code,
you don't deal with that. It's also obvious enough when you have an extra
character/space because PHP pukes on the screen and TELLS you something
about "blah blah sent before header output" or something to that effect.

What do you guys all do?

I also created a poll here http://www.rapidpoll.net/arc1opy

-----Original Message-----
From: Co-worker
To: Daevid Vincent

Actually, Zend states that you should omit the final ?> on include pages.
There is no harm in the action, and it prevents you from accidentally
adding white space after the tag which will break the code.

http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
l


-----Original Message-----
From: Daevid Vincent
To: Co-worker

Please DO include the final ?> I noticed on several of your files that you
have purposely omitted it. Yes, I know the files work without them, but it
makes things easier to see the pairings for matching things consistent and I'm not a big fan of "special cases" as this is,
especially if it's a bad habit to get into since in all other cases it's
required except this one "lazy" one. If you are concerned about white space
sending in a header or something, well then just make sure there isn't any.
I've had no problems and it makes you a more careful coder.

Thanks,

Daevid.


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

Re: POLL: To add the final ?> or not...

am 08.01.2010 21:37:31 von Ashley Sheridan

--=-cFS1aFfVBLQ8kGYfkwr7
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-01-08 at 12:24 -0800, Daevid Vincent wrote:

> I'm having a debate with a co-worker about adding the final ?> on a PHP
> page...
>
> To be honest, I am the lead, and I could pull rank and be done with the
> discussion, however I don't like to be that way. I would rather do the
> right thing. If my way of thinking is old-school (I've been coding since
> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
> rather adopt that, despite how icky it makes me feel to leave an unclosed
> > behind"! :)
>
> Is there ANY side-effects to leaving the end ?> off? Is it any more work
> for the compiler? And yes I know computers are hella-fast and all that, but
> I come from the gaming industry where squeeking out an extra FPS matters,
> and shaving off 0.01s per row of data in a table matters if you have more
> than 100 rows. A 1 second wait IS noticeable and a 10 second is even moreso
> -- just try to talk for 10 seconds straight without a pause. Or sit there
> and stare at a screen for 10 seconds!
>
> If the main argument is that it's to prevent white-space after the code,
> then most modern editors that I'm aware of will automatically trim
> white-space (or have a setting to do so). Plus this is ONLY a factor when
> you're trying to output a header and things like that. In 90% of your code,
> you don't deal with that. It's also obvious enough when you have an extra
> character/space because PHP pukes on the screen and TELLS you something
> about "blah blah sent before header output" or something to that effect.
>
> What do you guys all do?
>
> I also created a poll here http://www.rapidpoll.net/arc1opy
>
> -----Original Message-----
> From: Co-worker
> To: Daevid Vincent
>
> Actually, Zend states that you should omit the final ?> on include pages.
> There is no harm in the action, and it prevents you from accidentally
> adding white space after the tag which will break the code.
>
> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
> l
>
>
> -----Original Message-----
> From: Daevid Vincent
> To: Co-worker
>
> Please DO include the final ?> I noticed on several of your files that you
> have purposely omitted it. Yes, I know the files work without them, but it
> makes things easier to see the pairings for matching > things consistent and I'm not a big fan of "special cases" as this is,
> especially if it's a bad habit to get into since in all other cases it's
> required except this one "lazy" one. If you are concerned about white space
> sending in a header or something, well then just make sure there isn't any.
> I've had no problems and it makes you a more careful coder.
>
> Thanks,
>
> Daevid.
>
>


I always include the final ?> for neatness, and have had no problems
doing so. There is an argument that leaving off the ?> prevents
multibyte end of line markers from causing problems with headers being
sent when the PHP file is being included in another, but I've not had
this problem on the text editors I use.

That said, some systems do have coding style conventions regarding them,
so if your code is to be included in any of those, then maybe it's best
following their conventions.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-cFS1aFfVBLQ8kGYfkwr7--

Re: POLL: To add the final ?> or not...

am 08.01.2010 21:49:42 von LinuxManMikeC

http://framework.zend.com/manual/en/coding-standard.html#cod ing-standard.overview.scope
"This document provides guidelines for code formatting and
documentation to individuals and teams contributing to Zend
Framework."

So as far as anything other than code being contributed to Zend
Framework, its just a suggestion. For your programming team, you're
the boss, you make the decision. The only benefit I see is preventing
the white space mistake (as your co-worker's quote mentioned), but I
agree with you on that point. "Just don't put any white space
there... moron..." :-) Its an inconsequential option, pull rank, get
back to work.

On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
> I'm having a debate with a co-worker about adding the final ?> on a PHP
> page...
>
> To be honest, I am the lead, and I could pull rank and be done with the
> discussion, however I don't like to be that way. I would rather do the
> right thing. If my way of thinking is old-school (I've been coding since
> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
> rather adopt that, despite how icky it makes me feel to leave an unclosed
> > behind"! :)
>
> Is there ANY side-effects to leaving the end ?> off? Is it any more work
> for the compiler? And yes I know computers are hella-fast and all that, but
> I come from the gaming industry where squeeking out an extra FPS matters,
> and shaving off 0.01s per row of data in a table matters if you have more
> than 100 rows. A 1 second wait IS noticeable and a 10 second is even moreso
> -- just try to talk for 10 seconds straight without a pause. Or sit there
> and stare at a screen for 10 seconds!
>
> If the main argument is that it's to prevent white-space after the code,
> then most modern editors that I'm aware of will automatically trim
> white-space (or have a setting to do so). Plus this is ONLY a factor when
> you're trying to output a header and things like that. In 90% of your code,
> you don't deal with that. It's also obvious enough when you have an extra
> character/space because PHP pukes on the screen and TELLS you something
> about "blah blah sent before header output" or something to that effect.
>
> What do you guys all do?
>
> I also created a poll here http://www.rapidpoll.net/arc1opy
>
> -----Original Message-----
> From: Co-worker
> To: Daevid Vincent
>
> Actually, Zend states that you should omit the final ?> on include pages.
> There is no harm in the action, and it prevents you from accidentally
> adding white space after the tag which will break the code.
>
> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
> l
>
>
> -----Original Message-----
> From: Daevid Vincent
> To: Co-worker
>
> Please DO include the final ?> I noticed on several of your files that you
> have purposely omitted it. Yes, I know the files work without them, but it
> makes things easier to see the pairings for matching > things consistent and I'm not a big fan of "special cases" as this is,
> especially if it's a bad habit to get into since in all other cases it's
> required except this one "lazy" one. If you are concerned about white space
> sending in a header or something, well then just make sure there isn't any.
> I've had no problems and it makes you a more careful coder.
>
> Thanks,
>
> Daevid.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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

Re: POLL: To add the final ?> or not...

am 08.01.2010 22:26:28 von Ryan Sun

--001636c5a4bd3146f1047cadd703
Content-Type: multipart/alternative; boundary=001636c5a4bd3146eb047cadd702

--001636c5a4bd3146eb047cadd702
Content-Type: text/plain; charset=ISO-8859-1

if you use the newest PDT, you will find that a new php file has no final ?>
I vote for your co-worker [?]

On Fri, Jan 8, 2010 at 3:49 PM, LinuxManMikeC wrote:

>
> http://framework.zend.com/manual/en/coding-standard.html#cod ing-standard.overview.scope
> "This document provides guidelines for code formatting and
> documentation to individuals and teams contributing to Zend
> Framework."
>
> So as far as anything other than code being contributed to Zend
> Framework, its just a suggestion. For your programming team, you're
> the boss, you make the decision. The only benefit I see is preventing
> the white space mistake (as your co-worker's quote mentioned), but I
> agree with you on that point. "Just don't put any white space
> there... moron..." :-) Its an inconsequential option, pull rank, get
> back to work.
>
> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
> > I'm having a debate with a co-worker about adding the final ?> on a PHP
> > page...
> >
> > To be honest, I am the lead, and I could pull rank and be done with the
> > discussion, however I don't like to be that way. I would rather do the
> > right thing. If my way of thinking is old-school (I've been coding since
> > PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
> > rather adopt that, despite how icky it makes me feel to leave an unclosed
> > > left
> > behind"! :)
> >
> > Is there ANY side-effects to leaving the end ?> off? Is it any more work
> > for the compiler? And yes I know computers are hella-fast and all that,
> but
> > I come from the gaming industry where squeeking out an extra FPS matters,
> > and shaving off 0.01s per row of data in a table matters if you have more
> > than 100 rows. A 1 second wait IS noticeable and a 10 second is even
> moreso
> > -- just try to talk for 10 seconds straight without a pause. Or sit there
> > and stare at a screen for 10 seconds!
> >
> > If the main argument is that it's to prevent white-space after the code,
> > then most modern editors that I'm aware of will automatically trim
> > white-space (or have a setting to do so). Plus this is ONLY a factor when
> > you're trying to output a header and things like that. In 90% of your
> code,
> > you don't deal with that. It's also obvious enough when you have an extra
> > character/space because PHP pukes on the screen and TELLS you something
> > about "blah blah sent before header output" or something to that effect.
> >
> > What do you guys all do?
> >
> > I also created a poll here http://www.rapidpoll.net/arc1opy
> >
> > -----Original Message-----
> > From: Co-worker
> > To: Daevid Vincent
> >
> > Actually, Zend states that you should omit the final ?> on include pages.
> > There is no harm in the action, and it prevents you from accidentally
> > adding white space after the tag which will break the code.
> >
> >
> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
> > l
> >
> >
> > -----Original Message-----
> > From: Daevid Vincent
> > To: Co-worker
> >
> > Please DO include the final ?> I noticed on several of your files that
> you
> > have purposely omitted it. Yes, I know the files work without them, but
> it
> > makes things easier to see the pairings for matching > keeps
> > things consistent and I'm not a big fan of "special cases" as this is,
> > especially if it's a bad habit to get into since in all other cases it's
> > required except this one "lazy" one. If you are concerned about white
> space
> > sending in a header or something, well then just make sure there isn't
> any.
> > I've had no problems and it makes you a more careful coder.
> >
> > Thanks,
> >
> > Daevid.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--001636c5a4bd3146eb047cadd702
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

if you use the newest PDT, you will find that a new php file has no final ?=
>
I vote for your co-worker n: 0pt 0.2ex; vertical-align: middle;" src=3D"cid:gtalk.329@goomoji.gmail">=



On Fri, Jan 8, 2010 at 3:49 PM, LinuxManMike=
C <linuxman=
mikec@gmail.com
>
wrote:
style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8=
ex; padding-left: 1ex;">
standard.overview.scope" target=3D"_blank">http://framework.zend.com/manual=
/en/coding-standard.html#coding-standard.overview.scope


"This document provides guidelines for code formatting and

documentation to individuals and teams contributing to Zend

Framework."



So as far as anything other than code being contributed to Zend

Framework, its just a suggestion. =A0For your programming team, you're<=
br>
the boss, you make the decision. =A0The only benefit I see is preventing >
the white space mistake (as your co-worker's quote mentioned), but I >
agree with you on that point. =A0"Just don't put any white space r>
there... moron..." :-) =A0Its an inconsequential option, pull rank, ge=
t

back to work.



On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent < @daevid.com">daevid@daevid.com> wrote:

> I'm having a debate with a co-worker about adding the final ?> =
on a PHP

> page...

>

> To be honest, I am the lead, and I could pull rank and be done with th=
e

> discussion, however I don't like to be that way. I would rather do=
the

> right thing. If my way of thinking is old-school (I've been coding=
since

> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then =
I'd

> rather adopt that, despite how icky it makes me feel to leave an unclo=
sed

> <?php just dangling and alone, all sad-like. In my mind, "nobo=
dy gets left

> behind"! :)

>

> Is there ANY side-effects to leaving the end ?> off? Is it any more=
work

> for the compiler? And yes I know computers are hella-fast and all that=
, but

> I come from the gaming industry where squeeking out an extra FPS matte=
rs,

> and shaving off 0.01s per row of data in a table matters if you have m=
ore

> than 100 rows. A 1 second wait IS noticeable and a 10 second is even m=
oreso

> -- just try to talk for 10 seconds straight without a pause. Or sit th=
ere

> and stare at a screen for 10 seconds!

>

> If the main argument is that it's to prevent white-space after the=
code,

> then most modern editors that I'm aware of will automatically trim=


> white-space (or have a setting to do so). Plus this is ONLY a factor w=
hen

> you're trying to output a header and things like that. In 90% of y=
our code,

> you don't deal with that. It's also obvious enough when you ha=
ve an extra

> character/space because PHP pukes on the screen and TELLS you somethin=
g

> about "blah blah sent before header output" or something to =
that effect.

>

> What do you guys all do?

>

> I also created a poll here " target=3D"_blank">http://www.rapidpoll.net/arc1opy

>

> -----Original Message-----

> From: Co-worker

> To: Daevid Vincent

>

> Actually, Zend states that you should omit the final ?> on include =
pages.

> There is no harm in the action, and it prevents you from accidentally<=
br>
> adding white space after the tag which will break the code.

>

> e-formatting.htm" target=3D"_blank">http://framework.zend.com/manual/en/cod=
ing-standard.php-file-formatting.htm


> l

>

>

> -----Original Message-----

> From: Daevid Vincent

> To: Co-worker

>

> Please DO include the final ?> I noticed on several of your files t=
hat you

> have purposely omitted it. Yes, I know the files work without them, bu=
t it

> makes things easier to see the pairings for matching <?php . Plus i=
t keeps

> things consistent and I'm not a big fan of "special cases&quo=
t; as this is,

> especially if it's a bad habit to get into since in all other case=
s it's

> required except this one "lazy" one. If you are concerned ab=
out white space

> sending in a header or something, well then just make sure there isn&#=
39;t any.

> I've had no problems and it makes you a more careful coder.

>

> Thanks,

>

> Daevid.

>

>

> --

> PHP General Mailing List ( lank">http://www.php.net/)

> To unsubscribe, visit: =3D"_blank">http://www.php.net/unsub.php

>

>



--

PHP General Mailing List ( >http://www.php.net/)

To unsubscribe, visit: blank">http://www.php.net/unsub.php






--001636c5a4bd3146eb047cadd702--
--001636c5a4bd3146f1047cadd703--

Re: POLL: To add the final ?> or not...

am 08.01.2010 22:30:19 von Stut

On 8 Jan 2010, at 20:49, LinuxManMikeC wrote:

> =
http://framework.zend.com/manual/en/coding-standard.html#cod ing-standard.o=
verview.scope
> "This document provides guidelines for code formatting and
> documentation to individuals and teams contributing to Zend
> Framework."
>=20
> So as far as anything other than code being contributed to Zend
> Framework, its just a suggestion. For your programming team, you're
> the boss, you make the decision. The only benefit I see is preventing
> the white space mistake (as your co-worker's quote mentioned), but I
> agree with you on that point. "Just don't put any white space
> there... moron..." :-) Its an inconsequential option, pull rank, get
> back to work.

My opinion is that it's not an inconsequential option. Putting it in can =
cause issues, leaving it out does nothing but rub against some people's =
sense of neatness and order. Given the choice I'll always vote for the =
one that doesn't cause issues - I'd rather have people a tiny bit =
uncomfortable with not having it there than finding out there's a bit of =
whitespace at the end of a file when it could be in one of thousands. =
But maybe that's just me.

-Stuart

--=20
http://stut.net/

> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent =
wrote:
>> I'm having a debate with a co-worker about adding the final ?> on a =
PHP
>> page...
>>=20
>> To be honest, I am the lead, and I could pull rank and be done with =
the
>> discussion, however I don't like to be that way. I would rather do =
the
>> right thing. If my way of thinking is old-school (I've been coding =
since
>> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then =
I'd
>> rather adopt that, despite how icky it makes me feel to leave an =
unclosed
>> left
>> behind"! :)
>>=20
>> Is there ANY side-effects to leaving the end ?> off? Is it any more =
work
>> for the compiler? And yes I know computers are hella-fast and all =
that, but
>> I come from the gaming industry where squeeking out an extra FPS =
matters,
>> and shaving off 0.01s per row of data in a table matters if you have =
more
>> than 100 rows. A 1 second wait IS noticeable and a 10 second is even =
moreso
>> -- just try to talk for 10 seconds straight without a pause. Or sit =
there
>> and stare at a screen for 10 seconds!
>>=20
>> If the main argument is that it's to prevent white-space after the =
code,
>> then most modern editors that I'm aware of will automatically trim
>> white-space (or have a setting to do so). Plus this is ONLY a factor =
when
>> you're trying to output a header and things like that. In 90% of your =
code,
>> you don't deal with that. It's also obvious enough when you have an =
extra
>> character/space because PHP pukes on the screen and TELLS you =
something
>> about "blah blah sent before header output" or something to that =
effect.
>>=20
>> What do you guys all do?
>>=20
>> I also created a poll here http://www.rapidpoll.net/arc1opy
>>=20
>> -----Original Message-----
>> From: Co-worker
>> To: Daevid Vincent
>>=20
>> Actually, Zend states that you should omit the final ?> on include =
pages.
>> There is no harm in the action, and it prevents you from accidentally
>> adding white space after the tag which will break the code.
>>=20
>> =
http://framework.zend.com/manual/en/coding-standard.php-file -formatting.ht=
m
>> l
>>=20
>>=20
>> -----Original Message-----
>> From: Daevid Vincent
>> To: Co-worker
>>=20
>> Please DO include the final ?> I noticed on several of your files =
that you
>> have purposely omitted it. Yes, I know the files work without them, =
but it
>> makes things easier to see the pairings for matching keeps
>> things consistent and I'm not a big fan of "special cases" as this =
is,
>> especially if it's a bad habit to get into since in all other cases =
it's
>> required except this one "lazy" one. If you are concerned about white =
space
>> sending in a header or something, well then just make sure there =
isn't any.
>> I've had no problems and it makes you a more careful coder.
>>=20
>> Thanks,
>>=20
>> Daevid.
>>=20
>>=20
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>=20
>>=20
>=20
> --=20
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20


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

Re: POLL: To add the final ?> or not...

am 08.01.2010 22:38:37 von Ashley Sheridan

--=-F0q3Gt2YoVhAP08b+585
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-01-08 at 21:30 +0000, Stuart Dallas wrote:

> On 8 Jan 2010, at 20:49, LinuxManMikeC wrote:
>
> > http://framework.zend.com/manual/en/coding-standard.html#cod ing-standard.overview.scope
> > "This document provides guidelines for code formatting and
> > documentation to individuals and teams contributing to Zend
> > Framework."
> >
> > So as far as anything other than code being contributed to Zend
> > Framework, its just a suggestion. For your programming team, you're
> > the boss, you make the decision. The only benefit I see is preventing
> > the white space mistake (as your co-worker's quote mentioned), but I
> > agree with you on that point. "Just don't put any white space
> > there... moron..." :-) Its an inconsequential option, pull rank, get
> > back to work.
>
> My opinion is that it's not an inconsequential option. Putting it in can cause issues, leaving it out does nothing but rub against some people's sense of neatness and order. Given the choice I'll always vote for the one that doesn't cause issues - I'd rather have people a tiny bit uncomfortable with not having it there than finding out there's a bit of whitespace at the end of a file when it could be in one of thousands. But maybe that's just me.
>
> -Stuart
>
> --
> http://stut.net/
>
> > On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
> >> I'm having a debate with a co-worker about adding the final ?> on a PHP
> >> page...
> >>
> >> To be honest, I am the lead, and I could pull rank and be done with the
> >> discussion, however I don't like to be that way. I would rather do the
> >> right thing. If my way of thinking is old-school (I've been coding since
> >> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
> >> rather adopt that, despite how icky it makes me feel to leave an unclosed
> >> > >> behind"! :)
> >>
> >> Is there ANY side-effects to leaving the end ?> off? Is it any more work
> >> for the compiler? And yes I know computers are hella-fast and all that, but
> >> I come from the gaming industry where squeeking out an extra FPS matters,
> >> and shaving off 0.01s per row of data in a table matters if you have more
> >> than 100 rows. A 1 second wait IS noticeable and a 10 second is even moreso
> >> -- just try to talk for 10 seconds straight without a pause. Or sit there
> >> and stare at a screen for 10 seconds!
> >>
> >> If the main argument is that it's to prevent white-space after the code,
> >> then most modern editors that I'm aware of will automatically trim
> >> white-space (or have a setting to do so). Plus this is ONLY a factor when
> >> you're trying to output a header and things like that. In 90% of your code,
> >> you don't deal with that. It's also obvious enough when you have an extra
> >> character/space because PHP pukes on the screen and TELLS you something
> >> about "blah blah sent before header output" or something to that effect.
> >>
> >> What do you guys all do?
> >>
> >> I also created a poll here http://www.rapidpoll.net/arc1opy
> >>
> >> -----Original Message-----
> >> From: Co-worker
> >> To: Daevid Vincent
> >>
> >> Actually, Zend states that you should omit the final ?> on include pages.
> >> There is no harm in the action, and it prevents you from accidentally
> >> adding white space after the tag which will break the code.
> >>
> >> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
> >> l
> >>
> >>
> >> -----Original Message-----
> >> From: Daevid Vincent
> >> To: Co-worker
> >>
> >> Please DO include the final ?> I noticed on several of your files that you
> >> have purposely omitted it. Yes, I know the files work without them, but it
> >> makes things easier to see the pairings for matching > >> things consistent and I'm not a big fan of "special cases" as this is,
> >> especially if it's a bad habit to get into since in all other cases it's
> >> required except this one "lazy" one. If you are concerned about white space
> >> sending in a header or something, well then just make sure there isn't any.
> >> I've had no problems and it makes you a more careful coder.
> >>
> >> Thanks,
> >>
> >> Daevid.
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>


If someone is leaving whitespace all over the place that's causing those
sorts of problems, then their use of ?> is the least of your problems,
as I suspect their code layout is probably atrocious!

Getting code laid out correctly is far more important an issue than a
closing ?>, and when it's done correctly, you avoid a lot of problems,
more than a closing ?> can cause.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-F0q3Gt2YoVhAP08b+585--

Re: POLL: To add the final ?> or not...

am 08.01.2010 22:47:16 von Stut

On 8 Jan 2010, at 21:38, Ashley Sheridan wrote:
> On Fri, 2010-01-08 at 21:30 +0000, Stuart Dallas wrote:
>> On 8 Jan 2010, at 20:49, LinuxManMikeC wrote:
>>=20
>> >=20
>> =
http://framework.zend.com/manual/en/coding-standard.html#cod ing-standard.o=
verview.scope
>>=20
>> > "This document provides guidelines for code formatting and
>> > documentation to individuals and teams contributing to Zend
>> > Framework."
>> >=20
>> > So as far as anything other than code being contributed to Zend
>> > Framework, its just a suggestion. For your programming team, =
you're
>> > the boss, you make the decision. The only benefit I see is =
preventing
>> > the white space mistake (as your co-worker's quote mentioned), but =
I
>> > agree with you on that point. "Just don't put any white space
>> > there... moron..." :-) Its an inconsequential option, pull rank, =
get
>> > back to work.
>>=20
>> My opinion is that it's not an inconsequential option. Putting it in =
can cause issues, leaving it out does nothing but rub against some =
people's sense of neatness and order. Given the choice I'll always vote =
for the one that doesn't cause issues - I'd rather have people a tiny =
bit uncomfortable with not having it there than finding out there's a =
bit of whitespace at the end of a file when it could be in one of =
thousands. But maybe that's just me.
>>=20
>> -Stuart
>>=20
>> --=20
>>=20
>> http://stut.net/
>>=20
>>=20
>> > On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent <
>> daevid@daevid.com
>> > wrote:
>> >> I'm having a debate with a co-worker about adding the final ?> on =
a PHP
>> >> page...
>> >>=20
>> >> To be honest, I am the lead, and I could pull rank and be done =
with the
>> >> discussion, however I don't like to be that way. I would rather do =
the
>> >> right thing. If my way of thinking is old-school (I've been coding =
since
>> >> PHP/FI), and what he says is the newfangled proper PHP/Zend way, =
then I'd
>> >> rather adopt that, despite how icky it makes me feel to leave an =
unclosed
>> >> gets left
>> >> behind"! :)
>> >>=20
>> >> Is there ANY side-effects to leaving the end ?> off? Is it any =
more work
>> >> for the compiler? And yes I know computers are hella-fast and all =
that, but
>> >> I come from the gaming industry where squeeking out an extra FPS =
matters,
>> >> and shaving off 0.01s per row of data in a table matters if you =
have more
>> >> than 100 rows. A 1 second wait IS noticeable and a 10 second is =
even moreso
>> >> -- just try to talk for 10 seconds straight without a pause. Or =
sit there
>> >> and stare at a screen for 10 seconds!
>> >>=20
>> >> If the main argument is that it's to prevent white-space after the =
code,
>> >> then most modern editors that I'm aware of will automatically trim
>> >> white-space (or have a setting to do so). Plus this is ONLY a =
factor when
>> >> you're trying to output a header and things like that. In 90% of =
your code,
>> >> you don't deal with that. It's also obvious enough when you have =
an extra
>> >> character/space because PHP pukes on the screen and TELLS you =
something
>> >> about "blah blah sent before header output" or something to that =
effect.
>> >>=20
>> >> What do you guys all do?
>> >>=20
>> >> I also created a poll here=20
>> http://www.rapidpoll.net/arc1opy
>>=20
>> >>=20
>> >> -----Original Message-----
>> >> From: Co-worker
>> >> To: Daevid Vincent
>> >>=20
>> >> Actually, Zend states that you should omit the final ?> on include =
pages.
>> >> There is no harm in the action, and it prevents you from =
accidentally
>> >> adding white space after the tag which will break the code.
>> >>=20
>> >>=20
>> =
http://framework.zend.com/manual/en/coding-standard.php-file -formatting.ht=
m
>>=20
>> >> l
>> >>=20
>> >>=20
>> >> -----Original Message-----
>> >> From: Daevid Vincent
>> >> To: Co-worker
>> >>=20
>> >> Please DO include the final ?> I noticed on several of your files =
that you
>> >> have purposely omitted it. Yes, I know the files work without =
them, but it
>> >> makes things easier to see the pairings for matching it keeps
>> >> things consistent and I'm not a big fan of "special cases" as this =
is,
>> >> especially if it's a bad habit to get into since in all other =
cases it's
>> >> required except this one "lazy" one. If you are concerned about =
white space
>> >> sending in a header or something, well then just make sure there =
isn't any.
>> >> I've had no problems and it makes you a more careful coder.
>> >>=20
>> >> Thanks,
>> >>=20
>> >> Daevid.
>> >>=20
>> >>=20
>> >> --
>> >> PHP General Mailing List (
>> http://www.php.net/
>> )
>> >> To unsubscribe, visit:=20
>> http://www.php.net/unsub.php
>>=20
>> >>=20
>> >>=20
>> >=20
>> > --=20
>> > PHP General Mailing List (
>> http://www.php.net/
>> )
>> > To unsubscribe, visit:=20
>> http://www.php.net/unsub.php
>>=20
>> >=20
>>=20
>>=20
>>=20
>=20
> If someone is leaving whitespace all over the place that's causing =
those sorts of problems, then their use of ?> is the least of your =
problems, as I suspect their code layout is probably atrocious!
>=20
> Getting code laid out correctly is far more important an issue than a =
closing ?>, and when it's done correctly, you avoid a lot of problems, =
more than a closing ?> can cause.

That's a massive assumption. There are a number of editors that =
automatically add a blank line to the end of source files. I stand by =
taking the option that requires the least conscious thought from your =
developers - they have enough important stuff to occupy their brain that =
remembering to make sure there is no whitespace at the end of their =
source files should not be one of them.

-Stuart

--=20
http://stut.net/=

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

Re: POLL: To add the final ?> or not...

am 08.01.2010 23:32:13 von TedD

At 12:24 PM -0800 1/8/10, Daevid Vincent wrote:
>What do you guys all do?

I always close my code.

I have never had a problem in doing so.

I shall continue to close my code until it trips me up. At such time,
I'll figure out what the problem is and fix it. Then I'll probably
still close my code as is my habit.

However, I think there are more important things to ponder.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: POLL: To add the final ?> or not...

am 09.01.2010 02:26:29 von Mattias Thorslund

Hadn't paid much attention to the issue until reading a previous
discussion on the topic, here on this list. After that, I decided to be
consistent and leave the closing ?> out in all include files.

To my eyes, ?> means "look there is more content coming", which seems
kind of silly when there isn't.

A neat thing with pairing every when mixed in HTML is
that these are valid XML processing instructions. If your HTML satisfies
XML well-formedness, your PHP document will also be valid XML. Not that
I've ever had any need to process my layout templates as XML but anyway.

Cheers,

Mattias

Daevid Vincent wrote:
> I'm having a debate with a co-worker about adding the final ?> on a PHP
> page...
>
> To be honest, I am the lead, and I could pull rank and be done with the
> discussion, however I don't like to be that way. I would rather do the
> right thing. If my way of thinking is old-school (I've been coding since
> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
> rather adopt that, despite how icky it makes me feel to leave an unclosed
> > behind"! :)
>
> Is there ANY side-effects to leaving the end ?> off? Is it any more work
> for the compiler? And yes I know computers are hella-fast and all that, but
> I come from the gaming industry where squeeking out an extra FPS matters,
> and shaving off 0.01s per row of data in a table matters if you have more
> than 100 rows. A 1 second wait IS noticeable and a 10 second is even moreso
> -- just try to talk for 10 seconds straight without a pause. Or sit there
> and stare at a screen for 10 seconds!
>
> If the main argument is that it's to prevent white-space after the code,
> then most modern editors that I'm aware of will automatically trim
> white-space (or have a setting to do so). Plus this is ONLY a factor when
> you're trying to output a header and things like that. In 90% of your code,
> you don't deal with that. It's also obvious enough when you have an extra
> character/space because PHP pukes on the screen and TELLS you something
> about "blah blah sent before header output" or something to that effect.
>
> What do you guys all do?
>
> I also created a poll here http://www.rapidpoll.net/arc1opy
>
> -----Original Message-----
> From: Co-worker
> To: Daevid Vincent
>
> Actually, Zend states that you should omit the final ?> on include pages.
> There is no harm in the action, and it prevents you from accidentally
> adding white space after the tag which will break the code.
>
> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
> l
>
>
> -----Original Message-----
> From: Daevid Vincent
> To: Co-worker
>
> Please DO include the final ?> I noticed on several of your files that you
> have purposely omitted it. Yes, I know the files work without them, but it
> makes things easier to see the pairings for matching > things consistent and I'm not a big fan of "special cases" as this is,
> especially if it's a bad habit to get into since in all other cases it's
> required except this one "lazy" one. If you are concerned about white space
> sending in a header or something, well then just make sure there isn't any.
> I've had no problems and it makes you a more careful coder.
>
> Thanks,
>
> Daevid.
>
>
>


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

Re: POLL: To add the final ?> or not...

am 09.01.2010 05:25:23 von geek.de

--00151774149c638dcf047cb3b1c7
Content-Type: text/plain; charset=UTF-8

I would leave this to personal preference, whether there is a closing ?> or
not wouldn't bother me. I could argue both ways:

Pro: You should put a final ?> for neatness and XML compatibility.
Con: It makes the script fractionally slower because 2 more characters have
to be processed and there might be issues with the header when it's already
sent. I've had that problem before and it's really annoying.

Regards,
Tim
++Tim Hinnerk Heuer++

http://www.ihostnz.com


2010/1/9 Mattias Thorslund

> Hadn't paid much attention to the issue until reading a previous discussion
> on the topic, here on this list. After that, I decided to be consistent and
> leave the closing ?> out in all include files.
>
> To my eyes, ?> means "look there is more content coming", which seems kind
> of silly when there isn't.
>
> A neat thing with pairing every when mixed in HTML is that
> these are valid XML processing instructions. If your HTML satisfies XML
> well-formedness, your PHP document will also be valid XML. Not that I've
> ever had any need to process my layout templates as XML but anyway.
>
> Cheers,
>
> Mattias
>
>
> Daevid Vincent wrote:
>
>> I'm having a debate with a co-worker about adding the final ?> on a PHP
>> page...
>>
>> To be honest, I am the lead, and I could pull rank and be done with the
>> discussion, however I don't like to be that way. I would rather do the
>> right thing. If my way of thinking is old-school (I've been coding since
>> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
>> rather adopt that, despite how icky it makes me feel to leave an unclosed
>> >> behind"! :)
>>
>> Is there ANY side-effects to leaving the end ?> off? Is it any more work
>> for the compiler? And yes I know computers are hella-fast and all that,
>> but
>> I come from the gaming industry where squeeking out an extra FPS matters,
>> and shaving off 0.01s per row of data in a table matters if you have more
>> than 100 rows. A 1 second wait IS noticeable and a 10 second is even
>> moreso
>> -- just try to talk for 10 seconds straight without a pause. Or sit there
>> and stare at a screen for 10 seconds!
>>
>> If the main argument is that it's to prevent white-space after the code,
>> then most modern editors that I'm aware of will automatically trim
>> white-space (or have a setting to do so). Plus this is ONLY a factor when
>> you're trying to output a header and things like that. In 90% of your
>> code,
>> you don't deal with that. It's also obvious enough when you have an extra
>> character/space because PHP pukes on the screen and TELLS you something
>> about "blah blah sent before header output" or something to that effect.
>>
>> What do you guys all do?
>>
>> I also created a poll here http://www.rapidpoll.net/arc1opy
>>
>> -----Original Message-----
>> From: Co-worker
>> To: Daevid Vincent
>>
>> Actually, Zend states that you should omit the final ?> on include pages.
>> There is no harm in the action, and it prevents you from accidentally
>> adding white space after the tag which will break the code.
>>
>> http://framework.zend.com/manual/en/coding-standard.php-file -formatting.htm
>> l
>>
>>
>> -----Original Message-----
>> From: Daevid Vincent To: Co-worker
>>
>> Please DO include the final ?> I noticed on several of your files that you
>> have purposely omitted it. Yes, I know the files work without them, but it
>> makes things easier to see the pairings for matching >> things consistent and I'm not a big fan of "special cases" as this is,
>> especially if it's a bad habit to get into since in all other cases it's
>> required except this one "lazy" one. If you are concerned about white
>> space
>> sending in a header or something, well then just make sure there isn't
>> any.
>> I've had no problems and it makes you a more careful coder.
>>
>> Thanks,
>>
>> Daevid.
>>
>>
>>
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--00151774149c638dcf047cb3b1c7--

Re: POLL: To add the final ?> or not...

am 09.01.2010 06:07:43 von Robert Cummings

Mattias Thorslund wrote:
> Hadn't paid much attention to the issue until reading a previous
> discussion on the topic, here on this list. After that, I decided to be
> consistent and leave the closing ?> out in all include files.
>
> To my eyes, ?> means "look there is more content coming", which seems
> kind of silly when there isn't.

For mixed HTML/PHP files I add the ?> but for source only files I leave
it off.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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

Re: POLL: To add the final ?> or not...

am 09.01.2010 08:24:23 von Per Jessen

tedd wrote:

> At 12:24 PM -0800 1/8/10, Daevid Vincent wrote:
>>What do you guys all do?
>=20
> I always close my code.
>=20
> I have never had a problem in doing so.
>=20
> I shall continue to close my code until it trips me up. At such time,=

> I'll figure out what the problem is and fix it. Then I'll probably
> still close my code as is my habit.
>=20
> However, I think there are more important things to ponder.

+1

/Per

--=20
Per Jessen, Zürich (-4.4°C)


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

Re: POLL: To add the final ?> or not...

am 10.01.2010 15:41:19 von Michael Peters

Daevid Vincent wrote:

>
> What do you guys all do?

I keep it there, and just make sure not to have white space where it
should not be.

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

Re: POLL: To add the final ?> or not...

am 10.01.2010 15:44:34 von Michael Peters

Stuart Dallas wrote:

>
> That's a massive assumption. There are a number of editors that
> automatically add a blank line to the end of source files. I stand by
> taking the option that requires the least conscious thought from your
> developers - they have enough important stuff to occupy their brain
> that remembering to make sure there is no whitespace at the end of
> their source files should not be one of them.
>
> -Stuart
>

I would suggest getting a text editor that doesn't do that then. There
are text editors that don't.

There also are e-mail clients that properly wrap the body content before
sending ;)

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

Re: POLL: To add the final ?> or not...

am 10.01.2010 16:38:12 von Stut

On 10 Jan 2010, at 14:44, Michael A. Peters wrote:

> Stuart Dallas wrote:
>=20
>> That's a massive assumption. There are a number of editors that
>> automatically add a blank line to the end of source files. I stand by
>> taking the option that requires the least conscious thought from your
>> developers - they have enough important stuff to occupy their brain
>> that remembering to make sure there is no whitespace at the end of
>> their source files should not be one of them.
>> -Stuart
>=20
> I would suggest getting a text editor that doesn't do that then. There =
are text editors that don't.
>=20
> There also are e-mail clients that properly wrap the body content =
before sending ;)

I would rather not have a requirement on the tools my developers use =
which potentially (and usually) improves their productivity than impose =
a requirement that has no apparent benefit outside of XML files, and =
even then the benefit is irrelevant since it's already a file that =
contains both code and XML.

And if you don't like the way my emails look feel free to forward them =
into a black hole, I'll be fine with that. Alternatively talk to Apple =
and get them to change their Mail app to your idea or "properly". Either =
way I'm going to get back to worrying about things that matter. ;)

-Stuart

--=20
http://stut.net/=

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

Re: POLL: To add the final ?> or not...

am 10.01.2010 16:43:33 von Michael Peters

Stuart Dallas wrote:
> On 10 Jan 2010, at 14:44, Michael A. Peters wrote:
>
>> Stuart Dallas wrote:
>>
>>> That's a massive assumption. There are a number of editors that
>>> automatically add a blank line to the end of source files. I stand by
>>> taking the option that requires the least conscious thought from your
>>> developers - they have enough important stuff to occupy their brain
>>> that remembering to make sure there is no whitespace at the end of
>>> their source files should not be one of them.
>>> -Stuart
>> I would suggest getting a text editor that doesn't do that then. There are text editors that don't.
>>
>> There also are e-mail clients that properly wrap the body content before sending ;)
>
> I would rather not have a requirement on the tools my developers use which potentially (and usually) improves their productivity than impose a requirement that has no apparent benefit outside of XML files, and even then the benefit is irrelevant since it's already a file that contains both code and XML.
>
> And if you don't like the way my emails look feel free to forward them into a black hole, I'll be fine with that. Alternatively talk to Apple and get them to change their Mail app to your idea or "properly". Either way I'm going to get back to worrying about things that matter. ;)
>
> -Stuart
>

I suspect that you just don't word wrap enabled in your Mail.app
preferences. That use to be an option anyway (I haven't used OS X since
10.1)

Anyway, I didn't fix the wrap on this before replying just to show what
happens. Each paragraph end up as a big long line instead of having a
break put in.

Ah well, doesn't bother me as much as HTML mail to lists does ;)

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

Re: POLL: To add the final ?> or not...

am 10.01.2010 17:52:20 von List Manager

Stuart Dallas wrote:
>
> That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files.

A single \n after the final ?> doesn't matter anyways. Even if the following
example was two different files where the second included the first, it would
still have the same results.

Simple test:

########CONTENTS########

?>

echo (headers_sent() ? 'Yes' : 'No');

?>
########EOF########

No, as is, this will return 'No'. But if you place /ANY/ character between the
?>

including a newline, space, tab, etc... it will send the headers.

So, basically saying that in this particular case ?>\n
With all that said, you CAN have a \n at the end of you file directly after the
?>. But, you better make sure that nothing else is there along with it.

Jim Lucas

>
> -Stuart
>


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

Re: POLL: To add the final ?> or not...

am 10.01.2010 17:57:09 von Ashley Sheridan

--=-1wz4AqKB+jqwSbgbxIoK
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sun, 2010-01-10 at 08:52 -0800, Jim Lucas wrote:

> Stuart Dallas wrote:
> >
> > That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files.
>
> A single \n after the final ?> doesn't matter anyways. Even if the following
> example was two different files where the second included the first, it would
> still have the same results.
>
> Simple test:
>
> ########CONTENTS########
> >
> ?>
> >
> echo (headers_sent() ? 'Yes' : 'No');
>
> ?>
> ########EOF########
>
> No, as is, this will return 'No'. But if you place /ANY/ character between the
> ?>
> >
> including a newline, space, tab, etc... it will send the headers.
>
> So, basically saying that in this particular case ?>\n >
> With all that said, you CAN have a \n at the end of you file directly after the
> ?>. But, you better make sure that nothing else is there along with it.
>
> Jim Lucas
>
> >
> > -Stuart
> >
>


Or if you're using a multibyte encoding in your file which isn't
correctly interpretted...

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-1wz4AqKB+jqwSbgbxIoK--

Re: POLL: To add the final ?> or not...

am 11.01.2010 07:27:39 von Paul M Foster

On Sun, Jan 10, 2010 at 06:41:19AM -0800, Michael A. Peters wrote:

> Daevid Vincent wrote:
>
>>
>> What do you guys all do?
>

I leave it off. I don't want to have to worry about which editor I'm
using or whether I accidentally left some whitespace where it shouldn't
be.

Paul

--
Paul M. Foster

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

Re: POLL: To add the final ?> or not...

am 11.01.2010 09:24:48 von olavell

Paul M Foster wrote:

> I leave it off. I don't want to have to worry about which editor I'm
> using or whether I accidentally left some whitespace where it shouldn't
> be.

I also use different editors in different situations, both terminal based
and GUI. For instance I find Midnight Commander's internal editor quite
comfortable to use but unfortunately it does leave whitespace all over
the place.

This discussion made me think. From now on, I will probably also leave
the closing ?> off in include files. If something isn't really needed
then there is no rational reason to insist on using it.


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

Re: POLL: To add the final ?> or not...

am 11.01.2010 20:37:04 von bipper.goes

--0016e6dab54d7fbff9047ce8a9f8
Content-Type: text/plain; charset=ISO-8859-1

Ever write a string replace function on a closing ?> //somecomment here like
end junk

I have written some systems and gone back two to three years later and found
myself having to do such. Sloppy, sure. Minimize cost to the client? Oh
yeah.

I keep em, and comment 'em as I feel I should.

On Mon, Jan 11, 2010 at 2:24 AM, Olav wrote:

> Paul M Foster wrote:
>
> > I leave it off. I don't want to have to worry about which editor I'm
> > using or whether I accidentally left some whitespace where it shouldn't
> > be.
>
> I also use different editors in different situations, both terminal based
> and GUI. For instance I find Midnight Commander's internal editor quite
> comfortable to use but unfortunately it does leave whitespace all over
> the place.
>
> This discussion made me think. From now on, I will probably also leave
> the closing ?> off in include files. If something isn't really needed
> then there is no rational reason to insist on using it.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--0016e6dab54d7fbff9047ce8a9f8--

Re: POLL: To add the final ?> or not...

am 12.01.2010 17:04:30 von John Corry

--00163646b968204944047cf9cf94
Content-Type: text/plain; charset=ISO-8859-1

I leave ?> out.

I'm pretty careful about my code formatting and whitespace.

It's my opinion that if I can eliminate a potential problem by not including
an optional closing tag...there's really no reason why I shouldn't.
--
John Corry
PHP developer - 3by400, Inc
http://www.3by400.com

--00163646b968204944047cf9cf94--

Re: POLL: To add the final ?> or not...

am 12.01.2010 17:48:53 von LinuxManMikeC

On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
>
> I'm having a debate with a co-worker about adding the final ?> on a PHP
> page...
>

So everybody, when do we get to the real discussion? Which end of an
egg do we break?

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 18:10:14 von Michael Peters

LinuxManMikeC wrote:
> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
>> I'm having a debate with a co-worker about adding the final ?> on a PHP
>> page...
>>
>
> So everybody, when do we get to the real discussion? Which end of an
> egg do we break?
>

Depends upon how far away the Perl developer is when we throw it, and
how much spin we put on it.

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 18:22:22 von Robert Cummings

Michael A. Peters wrote:
> LinuxManMikeC wrote:
>> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
>>> I'm having a debate with a co-worker about adding the final ?> on a PHP
>>> page...
>>>
>> So everybody, when do we get to the real discussion? Which end of an
>> egg do we break?
>>
>
> Depends upon how far away the Perl developer is when we throw it, and
> how much spin we put on it.

You'll want to know initial release speed and drag on the egg while in
flight to calculate time so you can correctly determine how many spins
occur over the throw distance.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 18:24:06 von Ashley Sheridan

--=-n0NbGbPgZccZjc2f1vWB
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:

> Michael A. Peters wrote:
> > LinuxManMikeC wrote:
> >> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent wrote:
> >>> I'm having a debate with a co-worker about adding the final ?> on a PHP
> >>> page...
> >>>
> >> So everybody, when do we get to the real discussion? Which end of an
> >> egg do we break?
> >>
> >
> > Depends upon how far away the Perl developer is when we throw it, and
> > how much spin we put on it.
>
> You'll want to know initial release speed and drag on the egg while in
> flight to calculate time so you can correctly determine how many spins
> occur over the throw distance.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>


There's always a chance that if thrown, the egg won't contact end-on.
Has anyone thought to factor this in?

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-n0NbGbPgZccZjc2f1vWB--

Re: POLL: To add the final ?> or not...

am 12.01.2010 18:52:35 von TedD

At 5:24 PM +0000 1/12/10, Ashley Sheridan wrote:
>On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:

-- egg snip-its

While on the subject of eggs and other non-php topics, here's a life trick.

If you don't know if an egg is hard-boiled, or not, try spinning it.
A hard-boiled egg will spin while a raw egg will not.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 18:53:37 von Ashley Sheridan

--=-mWnNJlgnMV+YXEPpbWL0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2010-01-12 at 12:52 -0500, tedd wrote:

> At 5:24 PM +0000 1/12/10, Ashley Sheridan wrote:
> >On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:
>
> -- egg snip-its
>
> While on the subject of eggs and other non-php topics, here's a life trick.
>
> If you don't know if an egg is hard-boiled, or not, try spinning it.
> A hard-boiled egg will spin while a raw egg will not.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>


Is that just a cruel joke to get us all covered with raw egg? :p

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-mWnNJlgnMV+YXEPpbWL0--

Re: POLL: To add the final ?> or not...

am 12.01.2010 19:08:59 von Ashley Sheridan

--=-mSF+Jz2Yxi/mNGsfsmxM
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2010-01-12 at 13:10 -0500, Paul M Foster wrote:

> On Tue, Jan 12, 2010 at 05:24:06PM +0000, Ashley Sheridan wrote:
>
> > On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:
> >
> > > Michael A. Peters wrote:
> > > > LinuxManMikeC wrote:
> > > >> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent
> > wrote:
> > > >>> I'm having a debate with a co-worker about adding the final ?> on a PHP
> > > >>> page...
> > > >>>
> > > >> So everybody, when do we get to the real discussion? Which end of an
> > > >> egg do we break?
> > > >>
> > > >
> > > > Depends upon how far away the Perl developer is when we throw it, and
> > > > how much spin we put on it.
> > >
> > > You'll want to know initial release speed and drag on the egg while in
> > > flight to calculate time so you can correctly determine how many spins
> > > occur over the throw distance.
> > >
> > > Cheers,
> > > Rob.
> > > --
> > > http://www.interjinn.com
> > > Application and Templating Framework for PHP
> > >
> >
> >
> > There's always a chance that if thrown, the egg won't contact end-on.
> > Has anyone thought to factor this in?
>
> Is that an African or European egg?
>
> Paul
>
> --
> Paul M. Foster
>


Hehe, a fan of Monty Python I see!

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-mSF+Jz2Yxi/mNGsfsmxM--

Re: POLL: To add the final ?> or not...

am 12.01.2010 19:10:24 von Paul M Foster

On Tue, Jan 12, 2010 at 05:24:06PM +0000, Ashley Sheridan wrote:

> On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:
>
> > Michael A. Peters wrote:
> > > LinuxManMikeC wrote:
> > >> On Fri, Jan 8, 2010 at 1:24 PM, Daevid Vincent
> wrote:
> > >>> I'm having a debate with a co-worker about adding the final ?> on a PHP
> > >>> page...
> > >>>
> > >> So everybody, when do we get to the real discussion? Which end of an
> > >> egg do we break?
> > >>
> > >
> > > Depends upon how far away the Perl developer is when we throw it, and
> > > how much spin we put on it.
> >
> > You'll want to know initial release speed and drag on the egg while in
> > flight to calculate time so you can correctly determine how many spins
> > occur over the throw distance.
> >
> > Cheers,
> > Rob.
> > --
> > http://www.interjinn.com
> > Application and Templating Framework for PHP
> >
>
>
> There's always a chance that if thrown, the egg won't contact end-on.
> Has anyone thought to factor this in?

Is that an African or European egg?

Paul

--
Paul M. Foster

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 19:25:08 von Paul M Foster

On Tue, Jan 12, 2010 at 06:08:59PM +0000, Ashley Sheridan wrote:

> On Tue, 2010-01-12 at 13:10 -0500, Paul M Foster wrote:
>
> On Tue, Jan 12, 2010 at 05:24:06PM +0000, Ashley Sheridan wrote:
>



> >
> >
> > There's always a chance that if thrown, the egg won't contact end-on.
> > Has anyone thought to factor this in?
>
> Is that an African or European egg?
>
> Paul
>
> --
> Paul M. Foster
>
>
>
> Hehe, a fan of Monty Python I see!

Heck yeah. I can even program in their language a little bit!

Paul

--
Paul M. Foster

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 20:40:09 von Rolf Brejner

----- Original Message -----
From: "Paul M Foster"
To: "Ashley Sheridan"
Cc:
Sent: Tuesday, January 12, 2010 7:25 PM
Subject: Re: [PHP] POLL: To add the final ?> or not...


> On Tue, Jan 12, 2010 at 06:08:59PM +0000, Ashley Sheridan wrote:
>
>> On Tue, 2010-01-12 at 13:10 -0500, Paul M Foster wrote:
>>
>> On Tue, Jan 12, 2010 at 05:24:06PM +0000, Ashley Sheridan wrote:
>>
>
>
>
>> >
>> >
>> > There's always a chance that if thrown, the egg won't contact
>> end-on.
>> > Has anyone thought to factor this in?
>>
>> Is that an African or European egg?
>>
>> Paul
>>
>> --
>> Paul M. Foster
>>
>>
>>
>> Hehe, a fan of Monty Python I see!
>
> Heck yeah. I can even program in their language a little bit!
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
I can't find those egg-functions really - where do I look ?

REB


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

Re: POLL: To add the final ?> or not...

am 12.01.2010 21:49:15 von Robert Cummings

tedd wrote:
> At 5:24 PM +0000 1/12/10, Ashley Sheridan wrote:
>> On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:
>
> -- egg snip-its
>
> While on the subject of eggs and other non-php topics, here's a life trick.
>
> If you don't know if an egg is hard-boiled, or not, try spinning it.
> A hard-boiled egg will spin while a raw egg will not.

I didn't bother to try, but knowing about physics and fluids, I'm going
to argue that your assertion is untrue. The raw egg will spin but will
quickly slow down due to the internal drag of the viscous contents that
will be spinning at a much slower rate. In contrast the hard boiled egg
will not have this internal drag.

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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

Re: POLL: To add the final ?> or not...

am 12.01.2010 22:41:17 von TedD

At 3:49 PM -0500 1/12/10, Robert Cummings wrote:
>tedd wrote:
>>At 5:24 PM +0000 1/12/10, Ashley Sheridan wrote:
>>>On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:
>>
>>-- egg snip-its
>>
>>While on the subject of eggs and other non-php topics, here's a life trick.
>>
>>If you don't know if an egg is hard-boiled, or not, try spinning
>>it. A hard-boiled egg will spin while a raw egg will not.
>
>I didn't bother to try, but knowing about physics and fluids, I'm
>going to argue that your assertion is untrue. The raw egg will spin
>but will quickly slow down due to the internal drag of the viscous
>contents that will be spinning at a much slower rate. In contrast
>the hard boiled egg will not have this internal drag.
>
>Cheers,
>Rob.

Truth is relative when debating the spin of an egg. Of course, just
about everything you can hold, you can spin to some degree.

The point being, if you want a quick way to determine if an egg is
hard-boiled, or not, then spinning it will provide convincing
evidence as to which it is. The truth will be shown to those who try.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

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

Re: POLL: To add the final ?> or not...

am 13.01.2010 17:17:22 von bipper.goes

--0016e6d97670068428047d0e1bd1
Content-Type: text/plain; charset=ISO-8859-1

You could also sit on the egg.

On Tue, Jan 12, 2010 at 3:41 PM, tedd wrote:

> At 3:49 PM -0500 1/12/10, Robert Cummings wrote:
>
>> tedd wrote:
>>
>>> At 5:24 PM +0000 1/12/10, Ashley Sheridan wrote:
>>>
>>>> On Tue, 2010-01-12 at 12:22 -0500, Robert Cummings wrote:
>>>>
>>>
>>> -- egg snip-its
>>>
>>> While on the subject of eggs and other non-php topics, here's a life
>>> trick.
>>>
>>> If you don't know if an egg is hard-boiled, or not, try spinning it. A
>>> hard-boiled egg will spin while a raw egg will not.
>>>
>>
>> I didn't bother to try, but knowing about physics and fluids, I'm going to
>> argue that your assertion is untrue. The raw egg will spin but will quickly
>> slow down due to the internal drag of the viscous contents that will be
>> spinning at a much slower rate. In contrast the hard boiled egg will not
>> have this internal drag.
>>
>> Cheers,
>> Rob.
>>
>
> Truth is relative when debating the spin of an egg. Of course, just about
> everything you can hold, you can spin to some degree.
>
> The point being, if you want a quick way to determine if an egg is
> hard-boiled, or not, then spinning it will provide convincing evidence as to
> which it is. The truth will be shown to those who try.
>
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--0016e6d97670068428047d0e1bd1--

Re: POLL: To add the final ?> or not...

am 13.01.2010 21:25:55 von Nathan Rixham

Daevid Vincent wrote:
> I'm having a debate with a co-worker about adding the final ?> on a PHP
> page...
>
> To be honest, I am the lead, and I could pull rank and be done with the
> discussion, however I don't like to be that way. I would rather do the
> right thing. If my way of thinking is old-school (I've been coding since
> PHP/FI), and what he says is the newfangled proper PHP/Zend way, then I'd
> rather adopt that, despite how icky it makes me feel to leave an unclosed
> > behind"! :)
>
> Is there ANY side-effects to leaving the end ?> off? Is it any more work
> for the compiler? And yes I know computers are hella-fast and all that, but
> I come from the gaming industry where squeeking out an extra FPS matters,
> and shaving off 0.01s per row of data in a table matters if you have more
> than 100 rows. A 1 second wait IS noticeable and a 10 second is even moreso
> -- just try to talk for 10 seconds straight without a pause. Or sit there
> and stare at a screen for 10 seconds!
>
> If the main argument is that it's to prevent white-space after the code,
> then most modern editors that I'm aware of will automatically trim
> white-space (or have a setting to do so). Plus this is ONLY a factor when
> you're trying to output a header and things like that. In 90% of your code,
> you don't deal with that. It's also obvious enough when you have an extra
> character/space because PHP pukes on the screen and TELLS you something
> about "blah blah sent before header output" or something to that effect.
>
> What do you guys all do?
>

i negate the ?> and treat ?> purely as an instruction to tell php to
stop parsing (because that's what it is) thus for 100% php files you'll
find no ?> in my code; however when it's an html page and esacping in
and out of parser mode is required then obviously I'll use ?>

regards & sorry for the late reply

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

Re: POLL: To add the final ?> or not...

am 14.01.2010 23:28:13 von Kim Madsen

Hey

Haven't had the time to read up on the maillist, but here's my input.

Mattias Thorslund wrote on 09/01/2010 02:26:

> To my eyes, ?> means "look there is more content coming", which seems
> kind of silly when there isn't.

To mine it means, no more PHP code for now. I don't wanna make it
diffenrent from a file containing pure PHP code or one that contains
both PHP and HTML, where I jump in and out of the PHP tag.

Remember the ?> stops the parser

And I find it bad coding standard to start a tag and not end it, even if
it's possible. Remember Perl is a smart, but also terrible language,
where one can leave out the ; in the end of a oneline script and make a
bunch of stuff on $_ without showing what variable you're working on.

And finally, mysql_close() was always called after a script was closed,
so I've never learned to practice that and for the last ten years I've
seen only _one_ developer added that function call to the end of his
files. In PHP6 that call is required, so making the cleanest code is in
my opinion more readable and also more correct, since you'll never know
what the PHP core team will come up with next ;-)

> A neat thing with pairing every when mixed in HTML is
> that these are valid XML processing instructions. If your HTML satisfies
> XML well-formedness, your PHP document will also be valid XML. Not that
> I've ever had any need to process my layout templates as XML but anyway.

I don't see your argument. PHP generates HTML or XML files. When you're
aware of the XML tag of course you make sure the XML file generated is
valid. Why would you ever add PHP code to a HTML file (other than for
documentation, examples etc.)?

--
Kind regards
Kim Emax - masterminds.dk

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

Re: POLL: To add the final ?> or not...

am 14.01.2010 23:30:11 von Ashley Sheridan

--=-vga6Pjx4hbUz0bwNM07m
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Thu, 2010-01-14 at 23:30 +0100, Kim Madsen wrote:

> John Corry wrote on 12/01/2010 17:04:
> > I leave ?> out.
> >
> > I'm pretty careful about my code formatting and whitespace.
> >
> > It's my opinion that if I can eliminate a potential problem by not including
> > an optional closing tag...there's really no reason why I shouldn't.
>
> What is the difference between:
>
> > print "hello PHPeople";
> ?>WHITESPACE
>
> and
>
> > print "hello PHPeople";
> WHITESPACE
>
> Same shit when I look at it, a sloppy developer is what it is :-)
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>


Plenty of differences, if you include the first one as a file, the
whitespace gets sent to the browser because it is not part of the PHP,
and so is assumed to be HTML. Once this happens, the headers have been
sent, so you can't use different headers in your script.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-vga6Pjx4hbUz0bwNM07m--

Re: POLL: To add the final ?> or not...

am 14.01.2010 23:30:15 von Kim Madsen

John Corry wrote on 12/01/2010 17:04:
> I leave ?> out.
>
> I'm pretty careful about my code formatting and whitespace.
>
> It's my opinion that if I can eliminate a potential problem by not including
> an optional closing tag...there's really no reason why I shouldn't.

What is the difference between:

print "hello PHPeople";
?>WHITESPACE

and

print "hello PHPeople";
WHITESPACE

Same shit when I look at it, a sloppy developer is what it is :-)

--
Kind regards
Kim Emax - masterminds.dk

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

Re: POLL: To add the final ?> or not...

am 14.01.2010 23:36:52 von Ashley Sheridan

--=-WGwu8ZBaIZkKAk/JTUEd
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Thu, 2010-01-14 at 23:37 +0100, Kim Madsen wrote:

> Ashley Sheridan wrote on 14/01/2010 23:30:
>
> >> What is the difference between:
> >>
> >> > >> print "hello PHPeople";
> >> ?>WHITESPACE
> >>
> >> and
> >>
> >> > >> print "hello PHPeople";
> >> WHITESPACE
> >>
> >> Same shit when I look at it, a sloppy developer is what it is :-)
> >>
> >> --
> >> Kind regards
> >> Kim Emax - masterminds.dk
> >>
> >
> > Plenty of differences, if you include the first one as a file, the
> > whitespace gets sent to the browser because it is not part of the PHP,
> > and so is assumed to be HTML. Once this happens, the headers have been
> > sent, so you can't use different headers in your script.
>
> Hmm... you could be right. I guess I just never made that mistake :-)
> --
> Kind regards
> Kim Emax - masterminds.dk
>


What has been said on this thread a few times is it is not always a
developer error, but a bug with the editor, which is not something that
will be picked up until it occurs.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-WGwu8ZBaIZkKAk/JTUEd--

Re: POLL: To add the final ?> or not...

am 14.01.2010 23:37:11 von Kim Madsen

Ashley Sheridan wrote on 14/01/2010 23:30:

>> What is the difference between:
>>
>> >> print "hello PHPeople";
>> ?>WHITESPACE
>>
>> and
>>
>> >> print "hello PHPeople";
>> WHITESPACE
>>
>> Same shit when I look at it, a sloppy developer is what it is :-)
>>
>> --
>> Kind regards
>> Kim Emax - masterminds.dk
>>
>
> Plenty of differences, if you include the first one as a file, the
> whitespace gets sent to the browser because it is not part of the PHP,
> and so is assumed to be HTML. Once this happens, the headers have been
> sent, so you can't use different headers in your script.

Hmm... you could be right. I guess I just never made that mistake :-)
--
Kind regards
Kim Emax - masterminds.dk

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

Re: POLL: To add the final ?> or not...

am 15.01.2010 00:04:14 von Kim Madsen

Ashley Sheridan wrote on 14/01/2010 23:36:

> What has been said on this thread a few times is it is not always a
> developer error, but a bug with the editor, which is not something that
> will be picked up until it occurs.

Once again I love my VIm :-) (with whitespace highlight if needed)

--
Kind regards
Kim Emax - masterminds.dk

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

Re: POLL: To add the final ?> or not...

am 15.01.2010 00:18:40 von Ashley Sheridan

--=-2d8Jx76Ou5/nmUMod5RZ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Fri, 2010-01-15 at 00:04 +0100, Kim Madsen wrote:

> Ashley Sheridan wrote on 14/01/2010 23:36:
>
> > What has been said on this thread a few times is it is not always a
> > developer error, but a bug with the editor, which is not something that
> > will be picked up until it occurs.
>
> Once again I love my VIm :-) (with whitespace highlight if needed)
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>


I'm a fan of Kate myself, can recognise pretty much any language you
throw at it, and has a couple of neat plugins for web development

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-2d8Jx76Ou5/nmUMod5RZ--

Re: POLL: To add the final ?> or not...

am 15.01.2010 02:46:51 von bipper.goes

--0016e6dab6dc799d5c047d2a2d5f
Content-Type: text/plain; charset=ISO-8859-1

Wait, Kim, whats your last name?

On Thu, Jan 14, 2010 at 5:04 PM, Kim Madsen wrote:

> Ashley Sheridan wrote on 14/01/2010 23:36:
>
>
> What has been said on this thread a few times is it is not always a
>> developer error, but a bug with the editor, which is not something that will
>> be picked up until it occurs.
>>
>
> Once again I love my VIm :-) (with whitespace highlight if needed)
>
>
> --
> Kind regards
> Kim Emax - masterminds.dk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--0016e6dab6dc799d5c047d2a2d5f--

Re: POLL: To add the final ?> or not...

am 15.01.2010 02:57:38 von Mattias Thorslund

Kim Madsen wrote:
> Mattias Thorslund wrote on 09/01/2010 02:26:
>> A neat thing with pairing every when mixed in HTML is
>> that these are valid XML processing instructions. If your HTML
>> satisfies XML well-formedness, your PHP document will also be valid
>> XML. Not that I've ever had any need to process my layout templates
>> as XML but anyway.
> I don't see your argument. PHP generates HTML or XML files. When
> you're aware of the XML tag of course you make sure the XML file
> generated is valid. Why would you ever add PHP code to a HTML file
> (other than for documentation, examples etc.)?

It's not much of an argument, just an observation. And the conclusions
are disappointing anyway.

Certainly, if your script is designed to create XML, you'll make sure
that output is valid when executed by PHP. But it is interesting to note
that your PHP script file itself might qualify as valid XML under
certain circumstances, in which case you could process it with an XML
processor. This would let you modify the XML and still keep the PHP part
of the file intact.

I haven't seen a live example that might benefit from this, but I still
find it interesting.

The conditions that would need to be met, are that the content outside
the processing instructions must be well-formed XML, and there
are places where the processing instructions aren't expected in XML.

This is well-formed XML (and valid PHP):








This is not well-formed XML (processing instruction within a tag). Note
however that the output from PHP would be valid XML:



>



Neither is this (processing instruction within an attribute):







And neither is this (missing opening tag for the "root" element):



\n"; ?>



A simple way to test this would be to use this:
$sxe = new SimpleXMLElement('the_file.php', null, true);
echo $sxe->asXML()."\n";

The inability to insert dynamic content into attributes without breaking
the XML (ideas anyone?) does limit the usefulness of this technique, so
I guess it will just remain a curiosity.

Cheers,

Mattias

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

Re: POLL: To add the final ?> or not...

am 15.01.2010 03:17:24 von Jochem Maas

Op 1/14/10 11:37 PM, Kim Madsen schreef:
> Ashley Sheridan wrote on 14/01/2010 23:30:
>
>>> What is the difference between:
>>>
>>> >>> print "hello PHPeople";
>>> ?>WHITESPACE
>>>
>>> and
>>>
>>> >>> print "hello PHPeople";
>>> WHITESPACE
>>>
>>> Same shit when I look at it, a sloppy developer is what it is :-)
>>>
>>> --
>>> Kind regards
>>> Kim Emax - masterminds.dk
>>>
>>
>> Plenty of differences, if you include the first one as a file, the
>> whitespace gets sent to the browser because it is not part of the PHP,
>> and so is assumed to be HTML. Once this happens, the headers have been
>> sent, so you can't use different headers in your script.
>
> Hmm... you could be right. I guess I just never made that mistake :-)

could be right? that implies you don't know and didn't bother to test it.
I'd postulate that is sloppy. In another post you mention your reliance on
your favorite editor - relying blindly on your editor to 'do the right thing'
could also be considered sloppy (no tool is perfect all of the time).

pretty much every php dev has run into the issue of header() calls failing
due to whitespace, it's almost a rite of passage - I'd only call it a mistake
if you don't bother to test your code to the extent that you actually get into
a situation that you put something so obviously broken into a production env.

you mention that you guess as to whether you made the mistake in question, obviously
a an off the cuff remark and no worth tripping over in it's own right but it does
raise an interest point, namely that only sloppy devs are satified with guess work,
diligent devs either know or they don't and when they don't they take the time to
research and test until they feel confident to say that they do know - rather esoteric,
probably not very pragmatic, but there you have it nonetheless.

you offer to different pieces of pseudo-code and call them 'the same shit when you
look at it' - again there's an argument to say that's sloppy (in terms of reading code)
considering they are not identical in source nor resultant output.

.... same shit, different day ... or to put it another way, be very careful what you
post on a techie mailing list - you never know when some pendantic SOB is going to
rip you another 'one' in reply ;-).

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

RE: POLL: To add the final ?> or not...

am 28.01.2010 04:50:43 von Daevid Vincent

I think someone has been having fun with the Poll... ;-)

It used to be like 10::20 and now it's 71::31... Hmmm....


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

Re: POLL: To add the final ?> or not...

am 28.01.2010 07:14:18 von Rene Veerman

I'd give short-but-descriptive variable- and function-naming a much
higher priority than something that not really affects
code-reliability.

And i'd insist on doing all names and comments in english, even if
it's broken english.
It makes code much easier to be taken over by someone of another nationality.
If i'm paying for code, it would be on the top of my list of demands.

After that, i'd insist on the (beginner) programmer properly
commenting his code; "explain the code you're about to execute as you
would do in a brief manner to a layman/child, but let proper function
& parameter naming take care of as much of the "explanation" as
possible".
Cryptic code = BAD code, imo.
My comments (per loop of about 50 lines) are almost never longer than
3 lines of 80 chars. Mostly just 1 line.

So if i had to work with a beginner programmer, i would not give them
hassle over not closing their PHP tags.

On the other hand, i wouldn't really trust a mid- to advanced-level
programmer if he/she wasn't able to close their tags and make sure
there's no whitespace behind it. That kind of laziness/clumsiness will
lead to time-consuming mistakes elsewhere while building even
moderately complicated code.

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