In PHP, there are two types of comments: single-line comments and multi-line comments.Single-line comments: Single-line comments start with // and continue to the end of the line.
Single-line comments start with // and continue to the end of the line.
<?php
// This is a single-line comment
echo "Hello World";
?>
Output:
Hello World
Multi-line comments: Multi-line comments start with /* and end with */. They can span multiple lines.
<?php
/*
This is a multi-line
comment in PHP.
*/
echo "Hello World";
?>
Output:
Hello World
You can also use multi-line comments to temporarily disable parts of your code:
<?php
/*
echo "This line won't be executed.";
*/
echo "Hello World";
?>
Output:
Hello World