Difference between <?php and <?

The first is a safe open and close tag variation, the second is the so called short-open tag. The second one is not always available, use the first option if it's possible. You could check the availability of short open tags in php.ini, at the short_open_tag.


The problem with short open tags is that the following:

<?xml version="1.0" ?>

will cause problems if you're allowed to use short tags (i.e. <? and ?>). <?php is less open to misinterpretation.

Whether or not you're allowed to use short tags is defined by the ini directive short_open_tag.

Tags:

Php

Syntax