How to remove JS comments using PHP?
This question is updated: Nov. 4 2013 and answered by: Alexander Yancharuk
But there is a problem right now. A new code: id = id.r
Try this:
$output = "
//remove comment
this1 //remove comment
this2 /* remove comment */
this3 /* remove
comment */
this4 /* * * remove
* * * *
comment * * */
this5 http://removecomment.com
id = id.replace(/\//g,''); //do not remove the regex //
HTTP+'//www.googleadservices.com/pagead/conversion'
";
$pattern = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?
Result on codepad.org.