language.basic-syntax.instruction-separation.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 48 行

HTML
48
字号
<!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">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'This&nbsp;is&nbsp;a&nbsp;test'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span><br /><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'This&nbsp;is&nbsp;a&nbsp;test'&nbsp;</span><span style="color: #0000BB">?&gt;<br /></span><br /><span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">'We&nbsp;omitted&nbsp;the&nbsp;last&nbsp;closing&nbsp;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 + =
减小字号Ctrl + -
显示快捷键?