Possible Duplicate:
Are PHP short tags acceptable to use?
The <?=
is one of the very few elegant things about PHP, IMO. Yet, there are people that deliberately avoid it (in favor of the much longer <?php echo
). Why would they do that?
Possible Duplicate:
Are PHP short tags acceptable to use?
The <?=
is one of the very few elegant things about PHP, IMO. Yet, there are people that deliberately avoid it (in favor of the much longer <?php echo
). Why would they do that?
<?=
is easier to use but some servers don't support short tags. Therefore, if you ever run into a server that doesn't support them, you need to replace all tags.
A more elaborate answer is already given: Are PHP short tags acceptable to use?
Because the feature isn't enabled by default in PHP, so if someone else uses the code who doesn't, the code breaks.
Because by default servers aren't set up with php short-tag support, its something that needs to be toggled. if for some reason the server does not have short-tag support turned on, your code will error out. better to just add a couple characters, and aviod potential problems.
EDIT
search before posting: Are PHP short tags acceptable to use?
The problem is that not all servers support short tags
If you are developing an application for an controlled environment (for example, it will run only on your company server), then I don't see any problems with short tags
But, if it'll be a redistributable code, them you should open all tags explicitly <?php echo ?>
Many servers has got that <?
"shortform" turned off.
The only sure way to have your php executed is using the <?php
form. so you have to use <?php echo
in code you're going to distribute or reuse.