A comment is a type of text that is ignored by PHP. The comment is written so that your code can be understood by other programmers or developers.
In PHP, The main intention of a comment is to serve as a note for you, web developers or Programmers who can work the source code of the website.
Note: PHP comments can be used to code checking and debugging.
The single-line comment tells the interpreter to ignore everything that happens on the line that is to the right of the comment. One-line comment type to "//" or "#" and all text to the right will be ignored by the PHP interpreter.
There are two types of single-line comments in PHP.
It begins with // (Double Slash).
e.g.:- // This is addition function.
It begins with # (Hash).
e.g.:- # This is function need to re-check.
<!DOCTYPE html> <html> <body> <?php echo "Hello"; // Single line comment echo "w3alert"; # Single line comment ?> </body> </html>
Multi-line PHP comments can be used to write large blocks of code or multiple line comments. Many line PHP comments begin with "/ *" and end with "* /"
Begins with /* (Slash Star) and Ends */ (Star Slash).
e.g.:- /* This is
<!DOCTYPE html> <html> <body> <?php /* This is Multi-line comment */ echo "Welcome to w3alert.com"; ?> </body> </html>