A comment can be used to describe any line of code so that other developers can understand the code easily. It can also be used to hide any code. It is ignored by the compiler which means the compiler will not execute the code written inside the comment.
There are two types of comments in PHP.
- Single line comments.
- Multi line comments.
Single Line Comments.
<?php
// This is an example of single-line comment
# This is also an example of single-line comment
?>
Multi Line Comments.
<?php /* This is an example of multi line comment in PHP */ ?>