From: Robert Cummings on


Daevid Vincent wrote:
>> -----Original Message-----
>> From: Ashley Sheridan [mailto:ash(a)ashleysheridan.co.uk]
>>
>> ...as those tags only work when short_tags are turned on, which
>> itself causes problems with outputting XML from PHP.
>
> Can you elaborate on this Ashley?
>
> I use short tags and I output XML all the time. In fact I'm knee deep in
> building an API right now for Panasonic Avionics that is all XML based. We
> have hundreds of airplanes hitting the API, sending XML and getting XML
> back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
> bi-directional communication.
>
> This is the second XML API I've written for enterprise level service. I
> have no problems at all.
>
> I call poppycock. This sounds like FUD to me. ;-)

It's called a standard:

http://www.w3.org/TR/REC-xml/#sec-pi

A processing instruction without a target is incorrect. What should
process the data if there is no target? The assumption of PHP when no
target is declared is not part of the standard. Just because you've done
two anecdotal enterprise projects and haven't had a problem, doesn't
make it right.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
From: Robert Cummings on
Robert Cummings wrote:
>
> Daevid Vincent wrote:
>>> -----Original Message-----
>>> From: Ashley Sheridan [mailto:ash(a)ashleysheridan.co.uk]
>>>
>>> ...as those tags only work when short_tags are turned on, which
>>> itself causes problems with outputting XML from PHP.
>> Can you elaborate on this Ashley?
>>
>> I use short tags and I output XML all the time. In fact I'm knee deep in
>> building an API right now for Panasonic Avionics that is all XML based. We
>> have hundreds of airplanes hitting the API, sending XML and getting XML
>> back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
>> bi-directional communication.
>>
>> This is the second XML API I've written for enterprise level service. I
>> have no problems at all.
>>
>> I call poppycock. This sounds like FUD to me. ;-)
>
> It's called a standard:
>
> http://www.w3.org/TR/REC-xml/#sec-pi
>
> A processing instruction without a target is incorrect. What should
> process the data if there is no target? The assumption of PHP when no
> target is declared is not part of the standard. Just because you've done
> two anecdotal enterprise projects and haven't had a problem, doesn't
> make it right.

I spoke too fast, I thought we were talking about <? and not <?=
The latter is questionable since technically the = could be considered a
processing character (at least from what I read in the spec. Perhaps it
is ambiguous though with other languages.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
From: Robert Cummings on
Robert Cummings wrote:
> Robert Cummings wrote:
>> Daevid Vincent wrote:
>>>> -----Original Message-----
>>>> From: Ashley Sheridan [mailto:ash(a)ashleysheridan.co.uk]
>>>>
>>>> ...as those tags only work when short_tags are turned on, which
>>>> itself causes problems with outputting XML from PHP.
>>> Can you elaborate on this Ashley?
>>>
>>> I use short tags and I output XML all the time. In fact I'm knee deep in
>>> building an API right now for Panasonic Avionics that is all XML based. We
>>> have hundreds of airplanes hitting the API, sending XML and getting XML
>>> back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
>>> bi-directional communication.
>>>
>>> This is the second XML API I've written for enterprise level service. I
>>> have no problems at all.
>>>
>>> I call poppycock. This sounds like FUD to me. ;-)
>> It's called a standard:
>>
>> http://www.w3.org/TR/REC-xml/#sec-pi
>>
>> A processing instruction without a target is incorrect. What should
>> process the data if there is no target? The assumption of PHP when no
>> target is declared is not part of the standard. Just because you've done
>> two anecdotal enterprise projects and haven't had a problem, doesn't
>> make it right.
>
> I spoke too fast, I thought we were talking about <? and not <?=
> The latter is questionable since technically the = could be considered a
> processing character (at least from what I read in the spec. Perhaps it
> is ambiguous though with other languages.

And on further reading I'm pretty sure the = character does not fall
into the allowed caracters for a PITarget:

http://www.w3.org/TR/REC-xml/#NT-PITarget

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
From: Ashley Sheridan on
On Fri, 2010-06-11 at 10:40 -0700, Daevid Vincent wrote:

> > -----Original Message-----
> > From: Ashley Sheridan [mailto:ash(a)ashleysheridan.co.uk]
> >
> > ...as those tags only work when short_tags are turned on, which
> > itself causes problems with outputting XML from PHP.
>
> Can you elaborate on this Ashley?
>
> I use short tags and I output XML all the time. In fact I'm knee deep in
> building an API right now for Panasonic Avionics that is all XML based. We
> have hundreds of airplanes hitting the API, sending XML and getting XML
> back -- all via LAMP. I'm also simultaneously doing some cURL JSON-RPC
> bi-directional communication.
>
> This is the second XML API I've written for enterprise level service. I
> have no problems at all.
>
> I call poppycock. This sounds like FUD to me. ;-)
>
> D.
>
>


For <?= to work, the short_tags setting needs to be turned on I believe,
which can cause issues when outputting the XML declaration line unless
it's broken into two parts, which is messier than '<?php echo' IMHO.

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


From: tedd on
At 1:34 AM +0300 6/11/10, Ahmed Mohsen wrote:
>I know that i should use the full open tag in php <?php ?> but i
>want to know if its good to use this tag <?=$name?> instead of <?php
>echo $name ?>

Ahmed:

In many cases it boils down to an individual preference. I am sure
you will find programmers on both sides and in the middle of this
argument. Some saying they never use it, others saying that they
always use it, and still others saying "It depends" -- meaning they
use it in certain cases.

I believe, just because it can be done doesn't mean that it should be done.

My practice is *never* to use <?=

In fact, my practice is to not only use <?php echo, but to enclose
the echo argument with a (), like:

<?php echo("The answer is $answer");?>

I am sure there will be some that think that my practice is an
overkill, or not "good practice", but it's a good thing that we all
have a choice. Make your choice to best serve how you want your code
to look.

Cheers,

tedd

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