Search code examples
phphtmlcomments

Is there any benefit in using PHP comments over HTML comments in HTML code?


I heard someone say that there is, so I was wondering.

HTML comment:

<!-- Comment goes here. -->

PHP comment:

<?php // Comment goes here. ?>

Solution

  • Unlike HTML comments, PHP comments don't show up in the final output. That is often desirable, as comments are usually internal notes that are none of anybody's business.