PHP: Comments

Almost all the programming languages allow you to add comments to your code. Comments are read only by humans - the interpreter doesn't evaluate them. Comments serve as notes for those who wrote them and other developers. There are two types of comments in php:

Single line comments start with //. Whatever follows after will not be evaluated or executed.

A comment can take up the whole line:


// For Winterfell!

or can follow some code on the same line:


print_r('I am the King'); // => For Lannisters!

Multiline comments start with /* and end with */. Each line between them should start with a *.


 * The night is dark and
 * full of terrors.
print_r('I am the King');


Create a single line comment with the folowing text: You know nothing, Jon Snow!.


  • Comment - A comment is just a text and it doesn't affect program execution. Programmers use it to add notes for themselves and for their colleagues

If you got stuck and don't know what to do, you can ask a question in our huge and friendly community