Sorry for the silly question, but I ran across code that used:
<?=$MAP_OBJECT->printOnLoad();?>
<?=$MAP_OBJECT->printMap();?>
<?=$MAP_OBJECT->printSidebar();?>
Is there anything special about <?= over <?php or just plain <??
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Rather than talking about whether short_open_tags is deprecated or not we should talk about the advantages and disadvantages when using short open tags:
Advantages
Using the short open tags
<?along with<?=is shorter and probably easier to write than the standard opening tags<?phpand<?php echorespectively. That’s quite handy when using PHP directly in a template. (That’s probably also the reason why PHP has an alternative syntax for control structures.)Disadvantages
Requires a specific configuration
When using short open tags you are required to have short_open_tags enabled. If you or your web hosting provider decides to disable short_open_tags, your application probably won’t work any more and you can have some serious security issues. Because if short_open_tags is disabled, only the standard opening tags
<?phpare recognized and everything inside short opening tags is treated as plain text. (See also the blog post referenced in Sarfraz Ahmed’s answer.)This requirement makes your PHP application less portable if you aim to write applications that are not just for you. That’a also why many recommend not to use short open tags (including the PHP manual):
As of PHP 5.4
<?=is always available, regardless of theshort_open_tagsoption.<?on the other hand requires the option to be enabled.Conflicts with XML processing instructions
Another issue is when using XML processing instructions like
<?xml … ?>. When short_open_tags is enabled you cannot use them directly in your code but need to use PHP to output it:Otherwise PHP will choke on the
xmlin<?xml.Now some last words about the deprecation: Currently short_open_tags is not deprecated. Otherwise the manual would state that explicitly. Additionally, Rasmus Lerdorf, inventor of PHP, wrote in a reply on the question “Is it true that short_open_tag is deprecated in PHP 6?” on the internals mailing list that there were several reasons not to remove short_open_tags in PHP 6: