Home >Backend Development >PHP Tutorial >PHP Tags & Comments - PHP tags and comments
PHP tags
1. Standard Tags
Standard form
<code><span><?php</span><span>echo</span><span>'ABC'</span>; <span>?></span></code>
2. Short Tags
You need to set short_open_tag = On in php.ini
<code><span><?</span><span>echo</span><span>'ABC'</span>; <span>?></span></code>
3. Echo Short Tags
Short form for short tag output
PHP5.4 and above versions no longer need to set short_open_tag when using this form
<code><span><?</span>=<span>'ABC'</span>; <span>?></span><span><?</span>=<span>'A'</span>,<span>'B'</span>,<span>'C'</span>; <span>?></span></code>
4. ASP-Style Tags
You need to set asp_tags = On in php.ini
PHP7 is obsolete and no longer used
<code><% <span>echo</span><span>'ABC'</span>; %></code>
5. Echo ASP-Style Tags
Need to set asp_tags = On in php.ini
PHP7 has been deprecated and is no longer used
<code><%=<span>'ABC'</span>; %></code>
6. Script Tags
PHP7 has been deprecated and is no longer used
<code><script language=<span>"php"</span>><span>echo</span><span>'ABC'</span>;</script></code>
PHP comments
1. One-line C++ style
<code><span>// This is a one-line c++ style comment</span></code>
2. One-line shell style
<code><span># This is a one-line shell-style comment</span></code>
3. Multi-line comments
<code><span>/* This is a multi line comment yet another line of comment */</span></code>
The above has introduced PHP Tags & Comments - PHP tags and comments, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.