PHP codes must be enclosed by PHP tags. When PHP parser pareses a file , it looks for opening and closing PHP tags. It tells the parser when to start interpreting and when to stop. Reason for parsing in this manner is allowing to embed in different types of documents like HTML.
Example of PHP standard tag
Look at the code below
<?php echo "Hello world"; ?>
It is recommended to use PHP standard tag for compatibility an this tag can not be disabled by
Example of PHP short tag
<? echo "Hello world"; ?>
To use PHP short tag
short_open_tag must be set to
php.ini settings. But use of of PHP short open tag is not recommended.
If the file contains only PHP code, you can omit the end tag to avoid error due to whitespace added after the end tag. See the code below.
<?php echo "Hello world"; // code ends here with no PHP closing tag
The ASP tags
<%= and the script tag
<script language="php"> are removed from PHP 7.