In general, Comments are used in a programming language to describe the program or to hide the some part of code from the interpreter.
Comments in PHP can be used to explain any program code. It can also be used to hide the code as well.
Comment is not a part of the program, but it enhances the interactivity of the program and makes the program readable.
PHP supports two types of comments:
In case the developer wants to specify a single line comment, then the comment must start with " // "
// This is single line comment
In case of Multi lined comment, the comment must starts with /* and ends with */ i.e. /* .... */ .
/* This
Is
Multiline comment */
<html>
<head>
<title>Comments in PHP</title>
</head>
<body>
<h1>Comments in PHP</h1>
<?php
// echo prints something on screen
echo "This is My First PHP Example <br/>";
/* Comments are used to
hide or describe the
code in php */
echo ' This is an example to demonstrate comments in PHP ';
?>
</body>
</html>