Re: Newbie question about <?= ?>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
> 

- From my understanding, there are multiple reasons. One is that depending
on where your application is being hosted, the server it is on may have
turned off the short tags option (and you can't get your hosting
provider to change this). Thus, <?= ...?> would simply be written to the
page as that.

Additionally, through some of my training courses, another reason behind
it is that if you use PHP to generate any XML documents, XML uses <? ?>
syntax, and it's better to turn off the short tags in your PHP config so
that PHP doesn't attempt to interpret those tags as PHP code.

- --
Christopher Weldon
President, Lead Systems Administrator
Cerberus Interactive, Inc.
cweldon@xxxxxxxxxxxxxxxxxx
979.739.5874
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFAsRnZxvk7JEXkbERAiW+AJ9POOf3U1K6TiRVhSFC6ok7VjDm2ACfel8U
/6gFKYPPFYa5iyEtWdksZ0w=
=C1fK
-----END PGP SIGNATURE-----

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux