Comments in php are Non executable portion of code that is not executed as a part of the program. 

Comments in PHP help developers understand the code, provide context, and make the code more maintainable. 

There are two types of comments in PHP:

  1. Single-line Comments.
  2. Multi-line Comments.

1.  Single-line Comments:

Single-line comments start with ( // Everything come here ) and is not executed.

<?php
// single-line comment
echo "Hello, World!";
?>

2. Multi-line Comments:

Multi-line comments start with /* and end with */. Everything between  will not be executed.

<?php
/*
 multi-line comment
*/
echo "Hello, World!";
?>

Comments are useful for:

  • Documentation - for proper documentations.
  • Debugging - Used for Debugging Purpose.