Possible Duplicate:
Are PHP short tags acceptable to use?
I saw some people use
<?=
instead of
<?php echo
It does make all those
<td something><?php echo $result;?></td>
<td something><?php echo $result2;?></td>
shorter and easy to read (to me at least) but my question is: is it desirable to use this syntax? Or is it deprecated/discouraged/simply wrong?
Thanks!
Supposedly, some people have short tags disabled on their server, so this won’t work.
It’s best practice to use
<?php echo $var; ?>instead, but some will argue that it’s more readable to use short tags and that having them disabled is rare.For best results, avoid them.
EDIT: Apparently PHP 5.4 will allow you to use
<?=syntax regardless of server configuration (I was not aware). In that case, I still say – avoid it if you care about portability and different environments that may not be running 5.4, or may have short tags disabled.