Comments in PHP- Tutorialpath

php comments
php comments

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(//)

single line comments
single line comments

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 Ex of Single line Comment

single line comments
single line comments

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 (/*…..*/)

multiple line comments
multiple line comments

The all lines which is define in php environment are Multi line comments.
it is non-executable.Because it enclose with Multi line comments statement.
another Ex of Multi-line comments

anothe line comments
another line comments

Leave a Reply

Your email address will not be published.