How to Add Comments in PHP Code


How to Add Comments in PHP Code


Comments are useful for internal documentation of the code. Comments also helps in debugging of code. In PHP code we can add comments in almost similar way, we add in other programming Languages.


There are two types of Comments In PHP

  • Single Line Comments

  • Multi Line Comments 

Single Line Comments
Single Line Comments can be added in PHP by using the symbol  // before the lines of comment.

For example
<?php 
// this is my php code

?>

Multi line Comments
Multi Line comments can be added in PHP code by using combination of / and *.
For example 

<?php

/* this php code is 

  developed by me */


?>