From: Ahmed Mohsen on
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 ?>
From: Ashley Sheridan on
On Fri, 2010-06-11 at 01:34 +0300, 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 ?>
>


Depends who you ask, there was a discussion of this on the list a while
back, and the result was pretty split 50/50. Personally I think it's a
bad idea, as those tags only work when short_tags are turned on, which
itself causes problems with outputting XML from PHP. Yes it saves a
little bit of typing, but with a decent IDE you can set up a shortcut
for that sort of thing anyway, negating the extra seconds spent on a
large project by typing the echo statement.

There is also a potential issue when you move your code to a different
server, as short tags are not enabled by default as of PHP 5.

But, like I said, if you ask someone else, you'll likely get a different
opinion on this issue.

If you're the only one using this code, and the server is in your
control, then it's down to what you prefer to use. If the codebase is
shared, or the hosting is not in your control (shared hosting, etc) then
it's probably best to stick to the regular <?php echo $name ?> format.

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


From: David Harkness on
On Thu, Jun 10, 2010 at 3:34 PM, Ahmed Mohsen <mrez05(a)gmail.com> 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 ?>
>

According to some PHP 6 will remove support for short tags. They won't be
disabled by default--the feature simply won't exist.

http://www.slideshare.net/thinkphp/php-53-and-php-6-a-look-ahead

David
From: Daniel Brown on
On Thu, Jun 10, 2010 at 19:35, David Harkness <david.h(a)highgearmedia.com> wrote:
>
> According to some PHP 6 will remove support for short tags. They won't be
> disabled by default--the feature simply won't exist.
>
>    http://www.slideshare.net/thinkphp/php-53-and-php-6-a-look-ahead

I don't know why Stefan said that, but in fairness, that slideshow
is two years old. You'll still see short_open_tags, but you'll no
longer have ASP-style tags or the little-known <script language="PHP">
options available.

--
</Daniel P. Brown>
daniel.brown(a)parasane.net || danbrown(a)php.net
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!
From: Ahmed Mohsen on
On 6/11/2010 2:49 AM, Daniel Brown wrote:
> On Thu, Jun 10, 2010 at 19:35, David Harkness<david.h(a)highgearmedia.com> wrote:
>>
>> According to some PHP 6 will remove support for short tags. They won't be
>> disabled by default--the feature simply won't exist.
>>
>> http://www.slideshare.net/thinkphp/php-53-and-php-6-a-look-ahead
>
> I don't know why Stefan said that, but in fairness, that slideshow
> is two years old. You'll still see short_open_tags, but you'll no
> longer have ASP-style tags or the little-known<script language="PHP">
> options available.
>
It still much safer to use the full tag to avoid any errors in the future