How to write PHP Code?
1. Canonical PHP tags
The most universally effective PHP tag style is:
<?php ?>
If you use this style, you can be positive that your tags will always be correctly interpreted. Unless you have a very, very strong reason to prefer one of the other styles, use this one.
2. Short-open tags:
Short or short-open tags look like this:
<? ?>
Short tags are, as one might expect, the shortest option.
There are several reasons to resist the temptation of the short-open tag. PHP code written with short-open tags is less portable because you can’t be sure another machine will have enabled them. The most compelling reason now is that this syntax is not compatible with XML—and since XHTML is a type of XML, this implies that none of your code will be able to validate as XHTML.