When PHP processes a file, it looks for opening and closing tags, such as <?php и ?> , That tell PHP when to start and finish processing code between them. This processing method allows PHP to be embedded in all kinds of different documents, since everything outside the pair of opening and closing tags will be ignored by the PHP parser.
PHP also allows a short opening <? , however, it is undesirable to use them, as they are available only if enabled using the php.ini short_open_tag configuration directive php.ini short_open_tag (Set to On ), or if PHP has been configured with the --enable-short-tags option.
If the file contains only PHP code, it is preferable to omit the closing tag at the end of the file. This helps to avoid adding random space characters or line breaks after the closing PHP tag, which can cause unwanted effects, since PHP starts outputting data to the buffer if the programmer does not intend to output any data at this point in the script.
php 7.0.0 - ASP tags <%,%>, <% =, and script tags removed from PHP.
For later versions
5.4.0 The <?= Tag is always available, regardless of the short_open_tag setting.
Source: php.net