How do I comment multiple lines in PHP?
Comments in PHP
A comment in any computer program is a certain explanatory text that is ignored by the language compiler/interpreter. Its purpose is to help the user understand the logic used in the program algorithm. When using PHP, you have several options to choose from that stem from popular older languages with two choices of single line comments and also a multi-line C-style comment.
Single-line Comment in PHP
A single line in PHP code starting with the “#” symbol is treated as a single-line comment.
Example:
<?php # echo 'Hello World'; ?>
Alternative way: PHP also supports C style of single-line comments with “//” symbol. A line starting with double oblique symbol is treated as a comment.
Example:
<?php // echo 'Hello World'; ?>
Multiple line comment in PHP
The multi-line PHP comment can be used to comment out large blocks of code or writing multiple line comments. The multiple line PHP comment begins with ” /*” and ends with “*/“.
<?php /* Multi-line comment $a=10; $b=20; print "Total = ". $a+$b; */ ?>