Tuesday 12 November 2019

What's Comments in PHP ? by PMEARN.NET

What's Comments in PHP ? by PMEARN.NET
Today we are going to read about comments in PHP. Comments are the part of the code that is not executed with the code, meaning that writing or not writing comments on the code of the program does not matter. Comments are used to interpret the code.



There are 2 types of comments in PHP.

Single-Line Comment

Multiple-Lines Comment

Single-Line Comment: -PHP has two types of Single Line Comment. We understand this with the help of an example below.

Example 1.

<html>

<body>

<? php

// This is a single-line comment

# This is also a single-line comment

echo "Both Are Example of Single Line Comment";

</body>

</html>

So why you can see in the above hold how we can write single line comment in PHP with the help of both // and # these symbols.

Multiple-Lines Comment: - What we write in Single Line Comment is to be written in one line only, in such a case that if we ever want to write three four line comments, then we have to use the symbols used in single line comment again and again. To make this work easier, the facility of Multi Line Comment is available in php. In Multi Line Comment, we can write many lines of comment together very easily.

Example 2.

<html>

<body>

<? php

/ *

This is a multiple-lines comment

Learn PHP In Hindi

PMEARN.COM

* /

echo "Example Of Multi-Line Comment";

</body>

</html>

You can see an example of a Multi-Line Comment above.

thanks to visiting my site here we trying to help anyone and provide helpful articles.  
Share This :
SUBSCRIBE TO OUR NEWSLETTER