PHP Comment

  • Hi guys, in this tutorial we will learn PHP Comment.
  • PHP comment is a very important part of the project. Comments in PHP are similar to comments that are used in php file comment's main purpose of different developer read comment and know how to use this code for this functions PHP supports two types of comments
  • single line comment
  • Multiple lines comment

Single line comment:

  • PHP single line comment is used to make a comment for just single line of code. It starts with pound `//` or `#` icon. The rest of text after the sign is ignored code

Multi line comment:

  • PHP Multiple lines is a C language style comment. It starts with /* and ends with */. Whenever the comment needs to span on more lines, you use multiple lines comment.

PHP Syntax

<?php
	//Hello i'm single line comment
  #i'm single line comment
 /*
 i
 am
 multiline
 comment
  */
?>

PHP Example

Edit it yourself

<!DOCTYPE html>
<html>
<body>

<?php
  // This is a single line c++ style comment
    echo 'Hello World'; 

    #full name
    echo 'vikram ';
    
    /* The following multiple line examples
		for sum of two varable  */

    $a = 10;
    $b = 20;
    $sum = $a + $b;
    echo $sum;
?>


</body>
</html>

Output of PHP comment

Edit it yourself

30

  • Previous
  • Next