PHP Comments



Introduction :

  1. Like each and every programming language , PHP do support comments which is used to hide the unwanted code or for documentation purpose.
  2. PHP Comments makes development easy and provide great way to hide the un-wanted code.
  3. Like C Programming , PHP Supports two types of comments i.e Single Line Comment and Multiple Line Comment.

Live Example of Comment :

[box]In PHP, we use // to make a one-line comment or /* and */ to make a comment block[/box]

<html>
<body>
<?php
//This is a Single Line comment PHP
/*
This is
block comment in
PHP
*/
?>
</body>
</html>

Explanation :

  1. Comments in PHP can be Multiple Line or Single Line
  2. PHP Comments are used to hide the code or to prevent code from execution.
  3. PHP Comments can be used effectively by smart programmer for documentation.
  4. PHP Comments can be written at any place in the code.

External Article : What is Difference Between Block Comment and Single Line Comment.