php comment system code example
Example 1: php comment
Example 2: comment in php
<?php
$var = 2 + 2;
echo $var;
?>
Example 3: php comment
<?php
$x = 5 + 5;
echo $x;
?>
Example 4: comment in php
It is worth mentioning that, HTML comments have no meaning in PHP parser. So,
WILL execute some_function() and echo result inside HTML comment.
Example 5: comment in php
<?php
echo 'This is a test';
echo 'This is yet another test';
echo 'One Final Test';
?>
Example 6: comment in php
it's perhaps not obvious to some, but the following code will cause a parse error! the ?> in //?> is not treated as commented text, this is a result of having to handle code on one line such as <?php echo 'something'; ?>
<?php
if(1==1)
{
?>
}
?>
i discovered this "anomally" when i commented out a line of code containing a regex which itself contained ?>, with the // style comment.
e.g. //preg_match('/^(?>c|b)at$/', 'cat', $matches);
will cause an error while commented! using /**/ style comments provides a solution. i don't know about # style comments, i don't ever personally use them.