Even the official documentation used to tell us that PHP "short tags" (<? /*...*/ ?>
) are "bad". However, since PHP 5.4, the echo
variety <?= /*...*/ ?>
is permanently enabled regardless of the short_open_tag
setting.
What's changed?
Even if they were previously discouraged solely due to the unpredictable nature of whether short_open_tag
is enabled on a shared hosting platform, surely that argument doesn't go away just because some subset of hosts will be running PHP 5.4?
Arguably this change to the language doesn't inherently signify a change in the recommendation that we should nonetheless avoid "short tags", but if they've gone to the trouble it would certainly seem like the PHP devs no longer "hate" them so much. Right?
The only logical conclusion I can draw at this time is that there must be some objective rationale for the introduction of this change in PHP 5.4.
What is it?
<?=
(short-tag echo) is always enabled, but other short tag usages aren't (untested). Still, I'd be interested to know the reasoning for that change as well. – John Carter<?=
which is equivalent to<?php echo ...?>
is always available. – Cfreak<?
clashed with<?xml
. Now it was uncovered that most XML editors that people appearantly use for editing PHP files don't bail when encountering<?=
or so. – mario