Home > Backend Development > PHP Problem > what is php tag

what is php tag

(*-*)浩
Release: 2023-02-26 06:34:01
Original
5186 people have browsed it

When parsing a file, PHP looks for start and end tags, namely , which tell PHP to start and stop parsing the code in between.

what is php tag

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 , 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 结束标记
Copy after login

The above is the detailed content of what is php tag. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template