Re:Code that is valid in both PHP and Java, and produces the...
by mikeryan on Thursday September 01, 2016 @12:01AM
(#12403023)
You can use the same trick used here of hiding the PHP tags behind the comments /*<?php
[ Parent
| on HN ]
Re:Code that is valid in both PHP and Java, and produces the...
by ivanca on Thursday September 01, 2016 @01:35AM
(#12403293)
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 "-->";