Comment

A comment is the portion of a program that exists only for the human reader and stripped out before displaying the programs result. There are two commenting formats in PHP:

How many Types of Comment in PHP?

  • Single Line Comment
  • Multiple Line Comment
  • Single Line Comment:They are generally used for short explanations or notes relevant to the local code. Here are the examples of single line comments.
  • Multiple Line Comment:They are generally used to provide pseudocode algorithms and more detailed explanations when necessary. The multiline style of commenting is the same as in C. Here are the example of multi lines comments.
Single Line Comment Example

<?php 
# This is a comment, and 
# This is the second line of the comment 
// This is a comment too. Each style comments only 
print "An example with single line comments"; 
?> 
Output

An example with single line comments


Multiple Line Comment:
<?php 
/* This is a comment with multiline 
    Author : Mohammad Mohtashim 
    Purpose: Multiline Comments Demo 
    Subject: PHP 
*/ 
print "An example with multi line comments"; 
?>

Output:
An example with multi line comments





Get More Knoweledge You Join Sharda Technologies

No comments:

Post a Comment