📚 PHP Tutorial

PHP Tutorial

Learn PHP concepts with simple explanations, examples and practical notes.

Comments in PHP

In general, Comments are used in a programming language to describe the program or to hide the some part of code from the interpreter.

Comments in PHP can be used to explain any program code. It can also be used to hide the code as well.

Comment is not a part of the program, but it enhances the interactivity of the program and makes the program readable.

PHP supports two types of comments:

  • Single Line Comment
  • Multi Line Comment

1. Single Line Comment:

In case the developer wants to specify a single line comment, then the comment must start with " // "


format:
// This is single line comment

2. Multi Line Comment

In case of Multi lined comment, the comment must starts with /* and ends with */ i.e. /* .... */ .


format:
/* This 
    Is 
    Multiline comment */


Example: "commentdemo.php"


Output :

image