Is there any benefit in using PHP comments over HTML comments in HTML code? [closed] Is there any benefit in using PHP comments over HTML comments in HTML code? [closed] php php

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


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.


PHP comments will not be visible in the source on the client, where HTML comments will. So the question is: do you want the comment to be readable by the end user?


PHP comments do not show up in the output HTML as other users have stated. This has two main effects:

  1. The PHP comments are hidden from the end user. This has already been covered... And,
  2. The PHP comments don't get sent over the Internet. This will result in a bit of a performance boost for the end user. The benefit of this is of course dependent on your verbosity.