Re: <?= and <%= both work, why not <?php=
| From: | Sterling Hughes | Date: | Fri, 26 Apr 2002 18:07:02 +0000 |
| Subject: | Re: <?= and <%= both work, why not <?php= | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-83382@lists.php.net to get a copy of this message | ||
> Ok. #1 is the first logical, technical reason I've seen against the
> shorthand being fully implemented (though it begs the question why it was
> partially implemented in the first place).
>
> I'm not to knowledgeable about SGML specifics (and I can't afford to spend
> $200+ for a copy of the spec so I can spend a few weeks learning it just for
> this), so I can't go into that, but extending this to XML is a falacy,
> because PHP comparison syntax breaks the XML spec. I'm pretty sure that <%
> echo $var %> (valid PHP) would cause most XML parsers to choke.
>
Just a guess, but when you say the alphabet, do you often say it as such:
a,b,d,e,c,f,g,i...
?
Your argument shows you either don't know php, or don't know how to
think.
The whole point of the <?php tag is to allow people to embed commands in
XML documents. When short tags are disabled, commands such as <% echo
'HELLO'; %> don't work. If you allow <?php=?> syntax, it is not valid
XML, which negates the point of having <?php in the first place.
> As for #2 there's no flaw with the logic until you assume that '<?php echo '
> is somehow inherently more readable than '<?php= '. That's a matter of
> opinion either way.
>
Perhaps if it were a computer making these assumptions, yes. But anyone with half a
brain can see that <?php echo 'Hello'; ?> is much easer to understand
for someone with no programming experience, than: <?php='Hello'?>.
> By the time you get to #3, however, you've resorted to dreaming up new
> unrequested language extensions, and references to 'magic' to support your
> argument. I, and others, would argue that '<?php=' is no more 'magic'
> than
> '<?php echo'. We know what it means.
>
> If, as you imply, '<?=' and '<%=' are such a horrible
> "disease" that their
> very existance is proof that '<?php=' would be a syntactic travesty. Why
> were they allowed in the first place? If they were implemented "due to
> popular demand", why is popular demand not sufficient for '<?php='?
>
42
> If you really do want some equivalent to your proposed '<?php~ $foo:$bar
> ?>', then I might suggest '<?php= isset($foo)?$foo:$bar ?>', which I
> believe
> would already work as '<?php echo isset($foo)?$foo:$bar ?>', '<?=
> isset($foo)?$foo:$bar ?>'.
>
Thanks for the tip, we didn't realize that.
-Sterling