PHP single line comment is made in two ways:
- Using // (C++ style single line comment)
- Using # (Unix Shell style single line comment)
PHP multi-line comment is made by enclosing all lines within.
PHP single line comment is made in two ways:
PHP multi-line comment is made by enclosing all lines within.
Single-line comments use // or #; multi-line comments are written between /* and */.
<?php
// This is a single-line comment (C++ style)
# This is also a single-line comment (shell style)
/* This is a
multi-line comment
(C style) */
echo "Comments are ignored by PHP";
?>
Everything after // or # up to the end of the line is ignored. Everything between /* and */ is ignored, even across many lines. Multi-line comments cannot be nested inside one another.
Log in or create a free account to answer this question.