PHP start and end tags
When using PHP, you must tell the PHP engine that it has to parse the PHP. To do so, enclose your PHP code in PHP start and end tags.
There are four types of tags available: standard tags short tags, ASP tags, and script tags.
|Tag Style||Start Tag||End Tag|
|Script tags||<script language="php">||</script>|
Only standard and script tags are guaranteed to work on any PHP configuration. Short tags and ASP tags must be explicitly enabled in php.ini.
To enable short tags, ensure that the short_open_tag switch in php.ini is set to on to "On":
short_open_tag = On;
To enable ASP-style tags, ensure that the asp_tags is enabled in php.ini:
asp_tags = On;
Because both short tags and ASP-style tags require changes to the server configuration, it's best to use standard tags to ensure that your code is portable and reusable.
Additionally, <? tells an XML parser to expect a processing instruction and is often included in XML documents. Therefore, if you intend to include XML in your script, you should avoid using short tags because the PHP engine is likely to confuse XML processing instructions and PHP start tags. If you intend to incorporate XML in your document, you should disable short tags.