Re: '<?=' with PHP5.3.10

From: Date: Tue, 06 Mar 2012 03:44:24 +0000
Subject: Re: '<?=' with PHP5.3.10
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Mon, Mar 5, 2012 at 7:03 PM, Kris Craig <[email protected]> wrote:

> Certainly.  I don't believe this is about "inclusion" any more than
> creating a function called "ech" as an alias for "echo" would be.  The
> <?
> tag, as you all know, creates problems when working with XML.  Furthermore,
> I've never understood the "it's easier to read" argument since I've
> found
> it to be exactly the opposite.  The <? as opposed to <?php, at least for
> me, makes it more difficult to "at a glance" see where the PHP code begins
> (i.e. it's smaller and more ambiguous).  Also, since many hosts disable it
> by default, getting apps/frameworks that use them working can be an added
> pain.
>
> On the other hand, considering how verbose many of our function names are,
> I've never understood why the extra 3 characters (or 2 now that it's <?=)
> is such a burden that we have to deal with all the above annoyances
> instead.  Like I said, other than the fraction of a second it takes to type
> "php", I really don't see any value in this.
>

The tag <?= isn't a short version for <?php or <?. The <?= allows you to
echo output, so these two examples are equivalent:

<?php echo $var; ?>

<?= $var ?>

http://www.php.net/manual/en/ini.core.php#ini.short-open-tag

Before 5.4, turning off short tags turned off the shorthand echo tag, too.
The value I referenced was regarding the echo form of the tag (<?=), the
form of the tag Lester was troubleshooting. With 5.4, this will no longer
be a concern, as the echo form will always be available.

Adam


Thread (28 messages)

« previous php.internals (#58639) next »