Comments are an important part of PHP coding. Although you might remember tomorrow what you were trying to do with a certain bit of code, you probably won’t remember in six months. Document what you are trying to do as you do it.
Comments are not sent on to the browser so they don’t slow down your system. If you look at the source code of a web page, the only comments you see are HTML comments, not PHP comments.
There are two main types of PHP comments.
The first type is for commenting a single line or partial line. The comment starts with a // and ends at the end of the line:
<?PHP
//this is a single line comment
?>
The second type of comment is a block comment. The block comment starts with a /* and ends with a */:
<?PHP
/* This is a multiple line
comment format*/
?>
Comments in PHP
Comments are an important part of PHP coding. Although you might remember tomorrow what you were trying to do with a certain bit of code, you probably won’t remember in six months. Document what you are trying to do as you do it.
Comments are not sent on to the browser so they don’t slow down your system. If you look at the source code of a web page, the only comments you see are HTML comments, not PHP comments.
There are two main types of PHP comments.
The first type is for commenting a single line or partial line. The comment starts with a // and ends at the end of the line:
<?PHP
//this is a single line comment
?>
The second type of comment is a block comment. The block comment starts with a /* and ends with a */:
<?PHP
/* This is a multiple line
comment format*/
?>
Share this: