I have a javascript file, myjs.php, that is generated on the server and delivered to the browser with a header.
Header("content-type: application/x-javascript; charset=utf-8");
The file is large and contains a lot of comments that are echoed within the js sections:
echo " // comments /* comments */ etc.
I appreciate that, if necessary, I could rewrite the php so that all comments were within php sections.
Is there a way, within PHP, to remove these comments at runtime so that they are not part of the file that is delivered to the browser, either by minifying or by some other means?