PHP Comments - learn php - Phptpoint.com

PHP Comments

/ins>

Comments in PHP

A comment is non-executable lines. comment is used to write description  for your own understanding.Browser doesn’t read the comments.

There are two types of comments used in php

 

1. Single line comments :

Single line comment used for short explanations.
Declaration of Single line comment are two types
Either Begin with(#) Or backslash(//)

In the above Example.
*First and second line comments begin with hash(#).
*The third one is begin with(//).
If we check the output of the given example.
Browser show blank page. Because comments are always non-executable..

 
another Eg of Single line Comment

Output
welcome

In the above Example.
We declare a variable to store the String(“welcome”)
In second line we concatenate string(“student”) with the Previous string(“welcome”)
In third line we check the output.It shows Welcome Only. Because the second line statement has already specify a comment statement.
So it can’t take the string(“student”) as a declaration.

2. Multi-lines comments :

Multi lines comments  used to comment multiple lines.
Here we can give comments in bulk
The bulk comments are enclose within (/*…..*/)

The all lines which is define in php evironment are Multiline comments.
it is non-executable.Because it enlose with Multiline comments statement.
 

another eg of Multi-line comments

Output
Hello user how are you ?