Commenting your Code

Comments are used in PHP to allow you to write notes to yourself during the development process. Such comments may define the purpose of a code segment or to comment blocks of code while testing scripts.

Comments are ignored by the PHP parser. PHP comments can be defined in one of the following ways:

// - simple PHP comment

# - alternative simple PHP comment

/*...*/ - multi-line comment blocks.

<!DOCTYPE html PUBLIC "-//W3C//DTD/XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml11-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>A Web Page</title>
</head>
<body>

<p>

<?php 

// This is a simple PHP comment
#  This is a second simple PHP comment

/* This is a PHP multi-line 
comment block. It can span as
many lines as necessary */

?>

</p>
</body>
</html>