Is there a speed difference between <?php echo $var; ?> and <?=$var?>?
No, they are identical. If you like typing a lot use <?php echo $var; ?>
, otherwise just save time with <?=$var?>
.
Performance difference is insignificant. Moreover, with use of APC, performance difference is zero, null, nada.
Short tags are problematic within XML, because <?
is also markup for XML processing tag. So if you're writing code that should be portable, use the long form.
See short_open_tag
description in http://www.php.net/manual/en/ini.core.php
Performance wise it is insignificant.
Proper usage says to use the longer one, as it is more portable. Personally? I do the shorter one.
Technically the parser has to parse every character of the longer version, and there's a few more characters for every transfer.
If your webserver doesn't "pre-compile" (ie: cache tokenized PHP pages) then there is a slight performance difference. This should be insignificant except, perhaps, when you start talking about billions of runs.