I recently came across some code that looks something like this:
<head>
<?php /* The following scripts are required */ ?>
<script type="text/javascript" src="script.js"></script>
</head>
where the PHP consists only of a comment within an HTML document.
I imagine this was done to prevent the comment being visible in the source code of the page, and to make the resultant HTML page lighter. Clever.
However, I wonder what the performance impact, or any other notable caveat, of invoking the PHP engine for nothing is.
The performance impact is so incredibly tiny you don’t need to worry about it. Any impact would be offset by the bandwidth you save by not sending HTML comments to your user. On a very busy website, that would be a saving worth having.