Why are “echo” short tags permanently enabled as of PHP 5.4?

Short open tags are not always enabled since PHP 5.4. The documentation talks about the short echo tags. Which is a different thing. (short open tags are <? style tags, short echo tags are <?= style tags, for echo-ing).

Then why are they enabled by default now? Well, there are a lot of scripts out there, where it benefits to use <?= $somevar ?> instead of <?php echo $somevar ?>. And because the short echo tags aren’t as bad as the short open tags, they chose to always enable the short echo tags. Because now developers (of frameworks and CMS-es) can count on them (or rather, when PHP 5.4 becomes mainstream).

However, the short open tags are still influenced by the short_open_tag setting in your php.ini.

Leave a Comment