Actually that trick creates some residual garbage (the slash and the asterisk would be printed in PHP)
A way to avoid this is to use the HTML comment notation, JavaScript just ignores it (until end of line), so just:
<!-- <?php echo "-->";