<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/language.basic-syntax.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'language.basic-syntax.instruction-separation.php',
    1 => 'Instruction separation',
    2 => 'Instruction separation',
  ),
  'up' => 
  array (
    0 => 'language.basic-syntax.php',
    1 => 'Basic syntax',
  ),
  'prev' => 
  array (
    0 => 'language.basic-syntax.phpmode.php',
    1 => 'Escaping from HTML',
  ),
  'next' => 
  array (
    0 => 'language.basic-syntax.comments.php',
    1 => 'Comments',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'language/basic-syntax.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<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.
   </p>

   <p class="para">
    <div class="example" id="example-1">
     <p><strong>Example #1 Example showing the closing tag encompassing the trailing newline</strong></p>
     <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"Some text"</span><span style="color: #007700">; </span><span style="color: #0000BB">?&gt;<br /></span>No newline<br /><span style="color: #0000BB">&lt;?= </span><span style="color: #DD0000">"But newline now" </span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

     <div class="example-contents"><p>The above example will output:</p></div>
     <div class="example-contents screen">
<div class="annotation-interactive cdata"><pre>
Some textNo newline
But newline now
</pre></div>
     </div>
    </div>
   </p>

   <p class="para">
    <div class="example" id="example-2">
     <p><strong>Example #2 Examples of entering and exiting the PHP parser</strong></p>
     <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />    </span><span style="color: #007700">echo </span><span style="color: #DD0000">"This is a test\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;<br /></span><br /><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"This is a test\n" </span><span style="color: #0000BB">?&gt;<br /></span><br /><span style="color: #0000BB">&lt;?php </span><span style="color: #007700">echo </span><span style="color: #DD0000">"We omitted the last closing tag\n"</span><span style="color: #007700">;</span></span></code></div>
     </div>

    </div>
   </p>
   <p class="para">
    <blockquote class="note"><p><strong class="note">Note</strong>: 
     <p class="para">
      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 <span class="function"><a href="function.include.php" class="function">include</a></span>
      or <span class="function"><a href="function.require.php" class="function">require</a></span>, 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.
     </p>
    </p></blockquote>
   </p>
  </div><?php manual_footer($setup); ?>