Comments in PHP are similar to comments that are used in HTML. The PHP comment syntax always begins with a special character sequence and all text that appears between the start of the comment and the end will be ignored.
While there is only one type of comment in HTML, PHP has two types. The first type we will discuss is the single line comment. The single line comment tells the interpreter to ignore everything that occurs on that line to the right of the comment. To do a single line comment type "//" or "#" and all text to the right will be ignored by PHP interpreter.
<?php print "This is printed\n"; // print "This is not printed\n"; # print "This is not printed\n"; print "This is printed\n"; ?>
This is printed This is printed
Similiar to the HTML comment, 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 print "This is printed\n"; /* print "This is not printed\n"; print "This is not printed\n"; */ ?>
This is printed