Comments tell the PHP processor to ignore what follows the comment, or what is inside the comment.

Use comments to leave notes for yourself and others, to document your work, to indicate changes over time, and so forth.

Comments are also used to de-activate code when debugging a program. If you suspect that some line of code is buggy, you can “comment it out” and then test how the program behaves without it.

It’s common practice to make a copy of a suspected buggy code, “comment out” the original, then edit the copy until the code is correct. Having a the commented-out original can be useful as you are editing the original; if need be, you can discard or comment out the copy, un-comment the original, and you are back where you started without having lost any work.

In PHP, comments look like this:


// Double forward slash indicates that remainder of line (to right) is a comment


Forward slash followed by asterisk begins a multi-line comment

Use asterisk followed by slash to end a multi-line comment



Screenshot from Dreamweaver code view:


PHP Syntax @