Php – How do HTML comments work with PHP code


I just wonder how does html comment tag work with php code.

If I have the following code, does php parse it anyway?

   echo "hi";

a simple question, but I guess it is important to know.

Best Solution

Oh yes, anything in PHP blocks gets executed, but in this case, it isn't shown to the end user because it's in HTML comments.

In the source of the page that is generated by this PHP script, you will see the output surrounded by HTML comments, simple as that.

The only way comments will affect the output of a PHP script is with valid PHP comments.