When parsing a file, PHP looks for start and end tags, namely , which tell PHP to start and stop parsing the code in between.
This parsing method allows PHP to be embedded in various documents, and any part other than the start and end tags will be Ignored by the parser.
PHP also allows the use of the short tags and ?>, but their use is discouraged. (Recommended learning: PHP video tutorial)
Only by activating the short_open_tag configuration directive in php.ini or using the configuration option --enable-short-tags when compiling PHP Short tags can only be used when
If the file content is pure PHP code, it is best to remove the PHP closing tag at the end of the file.
This can avoid that if spaces or newlines are accidentally added after the PHP end tag, PHP will start to output these spaces, and there is no intention to output them in the script at this time.
<?php echo "Hello world"; // ... more code echo "Last statement"; // 脚本至此结束,并无 PHP 结束标记
The above is the detailed content of what is php tag. For more information, please follow other related articles on the PHP Chinese website!