PHP echo vs PHP short tags
Echo is generally just better to use because...
- It supports good programming style.
- It can't be turned off in php.ini (short tags can be)
Short tags will be removed in PHP 6)
But, they are generally the same. See also:
Are they equal in safeness? I was informed that using
was less safe, and that it slows down page load times. I am strictly biased to using echo.
What are the advantages/disadvantages?
Starting with PHP 5.4, short echo tag is always recognized and valid, regardless of the
short_open_tag Off or On doesn't matter anymore.
So now you can, without concern, put tags like this in your templates:
<?= (($test) ? "val1" : "val2") ?>
It is official now, the "short echo tag" is something very different than the "short tag".
So why don't they just remove the option to turn off short open tag and let it be enabled by default.
This is a VERY dangerous move by PHP. The reason being, if you put your existing code that has short tags in it on a PHP6 server and someone views that page, they will get the raw code downloaded to their browser which you can view. This could seriously kill off PHP.