Comments
Single line
# Shell style comment
// C++ style comment
- Single-line comments apply up to the end
of the line or
the current block of PHP code, whichever comes first.
- They cannot be used to comment an entire
line of code, if the
code contains a closing PHP tag (even if there's no additional code
after the closing PHP tag).
- There may be other instances in which
single-line comments
don't work as expected (non-intuitive), especially where there's a mix
of html and PHP code.
- They're not truly end-of-line comments as
in C++, Perl, Java,
etc.
<h1>This is an <?php # echo "simple";?>example.</h1>
<p>The header above will say 'This is an example'.</p>
Multiple lines
/* C style comment */
/* This comment spans
multiple lines */
- C style comments cannot be nested.