On Saturday 09 September 2006 08:19, Mike Borrelli wrote:
> Good day,
>
> While I've been using php for more than a little while now, I've never
> understood why the use of the "<?= ...?>" short tag is noted "to be
> avoided".
>
> Or rather, I understand that there's an option to disable it, and that's
> why it's noted in this way, but I don't understand why it's disabled?
> What's gained by writing <?php echo some_function(); ?> over <?=
> some_function(); ?>
>
> Thanks in advance.
>
> Cheers,
> Mike

As was said before, the major reasons for not using short tags are:

1) Not everyone has access to the ini file, and might not be able to use short 
tags.  If you're releasing your code to the public, you want to work in as 
many places as possible, so then you should use <?php instead.

2) when using XML files, they use <?xml, and the <? is recognized as the start 
of a PHP block, but the following syntax will be correct and your code will 
fail.  I have seen that someone suggested having PHP recognize <?xml as not 
being a PHP short tag, but I don't remember where off the top of my head.

This does bring up an interesting idea though.  It appears that <?php= is not 
valid.  A lot of people use <?= as a sort of templating system instead of 
adding the complexity of smarty or other templating systems (which are fine).  
Is it possible, or will it be possible, to use <?php="blah" ?>

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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

Reply via email to