📄 language.basic-syntax.instruction-separation.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Instruction separation</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.basic-syntax.html">Basic syntax</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.basic-syntax.comments.html">Comments</a></div> <div class="up"><a href="language.basic-syntax.html">Basic syntax</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="language.basic-syntax.instruction-separation" class="sect1"> <h2 class="title">Instruction separation</h2> <p class="para"> As in C or Perl, PHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of PHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a PHP block. The closing tag for the block will include the immediately trailing newline if one is present. <div class="informalexample"> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br /> </span><span style="color: #007700">echo </span><span style="color: #DD0000">'This is a test'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?><br /></span><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">'This is a test' </span><span style="color: #0000BB">?><br /></span><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">'We omitted the last closing tag'</span><span style="color: #007700">;</span></span></code></div> </div> </div> <blockquote><p><b class="note">Note</b>: The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using <b>include()</b> or <b>require()</b>, so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files. <br /> </p></blockquote> </p> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="language.basic-syntax.html">Basic syntax</a></div> <div class="next" style="text-align: right; float: right;"><a href="language.basic-syntax.comments.html">Comments</a></div> <div class="up"><a href="language.basic-syntax.html">Basic syntax</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -