php comments

A comment in PHP code is a line that is not read/executed as part of the program. So PHP Comments can be used as the guidelines for the developer

Purpose of comments

  • Let others understand what you are doing.
  • Remind yourself of what you did.

It is very common thing that happens with we programmers that we code a lot, we did many big things but after some time, we also forget why we did a particular code. For example:

We have made a project but after a month or so, that project came back for some updates. At that time, we can do the tasks in better and easy fashion if we know why the previous code is there. So comments are necessary.

PHP supports several ways of commenting:

Single Line Commenting:

The syntax for single line commenting is // and then the comment line. For example:

Multiline commenting:

As name suggesting, it is used for multiple line commenting. For example:

So now you know about using php comments .

If you have any question, ask its at our Forum Section.