<?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.comments.php',
    1 => 'Comments',
    2 => 'Comments',
  ),
  'up' => 
  array (
    0 => 'language.basic-syntax.php',
    1 => 'Basic syntax',
  ),
  'prev' => 
  array (
    0 => 'language.basic-syntax.instruction-separation.php',
    1 => 'Instruction separation',
  ),
  'next' => 
  array (
    0 => 'language.types.php',
    1 => 'Types',
  ),
  '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.comments" class="sect1">
   <h2 class="title">Comments</h2>
   <p class="para">
    PHP supports &#039;C&#039;, &#039;C++&#039; and Unix shell-style (Perl style) comments. For example:
   </p>
   <p class="para">
    <div class="example" id="example-1">
     <p><strong>Example #1 Comments</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">; </span><span style="color: #FF8000">// This is a one-line c++ style comment<br />    /* This is a multi line comment<br />       yet another line of comment */<br />    </span><span style="color: #007700">echo </span><span style="color: #DD0000">"This is yet another test\n"</span><span style="color: #007700">;<br />    echo </span><span style="color: #DD0000">"One Final Test\n"</span><span style="color: #007700">; </span><span style="color: #FF8000"># This is a one-line shell-style comment<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
   <p class="simpara">
    The &quot;one-line&quot; comment styles only comment to the end of
    the line or the current block of PHP code, whichever comes first.
    This means that HTML code after <code class="literal">// ... ?&gt;</code>
    or <code class="literal"># ...  ?&gt;</code> WILL be printed:
    ?&gt; breaks out of PHP mode and returns to HTML mode, and
    <code class="literal">//</code> or <code class="literal">#</code> cannot influence that.
   </p>
   <p class="para">
    <div class="example" id="example-2">
     <p><strong>Example #2 One Line Comments</strong></p>
     <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000">&lt;h1&gt;This is an <span style="color: #0000BB">&lt;?php </span><span style="color: #FF8000"># echo 'simple';</span><span style="color: #0000BB">?&gt;</span> example&lt;/h1&gt;<br />&lt;p&gt;The header above will say 'This is an  example'.&lt;/p&gt;</span></code></div>
     </div>

    </div>
   </p>
   <p class="simpara">
    &#039;C&#039; style comments end at the first <code class="literal">*/</code> encountered.
    Make sure you don&#039;t nest &#039;C&#039; style comments. It is easy to make this
    mistake if you are trying to comment out a large block of code.
   </p>
   <p class="para">
    <div class="informalexample">
     <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: #FF8000">/*<br />    echo 'This is a test'; /* This comment will cause a problem */<br /> </span><span style="color: #007700">*/<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
     </div>

    </div>
   </p>
  </div><?php manual_footer($setup); ?>