Comments

PHP supports 'C', 'C++' and Unix shell-style comments. For example:

  1 
  2 <?php
  3     echo "This is a test"; // This is a one-line c++ style comment
  4     /* This is a multi line comment
  5        yet another line of comment */
  6     echo "This is yet another test";
  7     echo "One Final Test"; # This is shell-style style comment
  8 ?>
  9      

The "one-line" comment styles actually only comment to the end of the line or the current block of PHP code, whichever comes first.

  1 
  2 <h1>This is an <?# echo "simple";?> example.</h1>
  3 <p>The header above will say 'This is an example'.
  4 

You should be careful not to nest 'C' style comments, which can happen when commenting out large blocks.

  1 
  2 <?php
  3  /* 
  4     echo "This is a test"; /* This comment will cause a problem */
  5  */
  6 ?>
  7