Last updated on September 17, 2014
In my recent project there are lot of HTML comments for each block. I don’t want to show the comments when viewing the source code because there is no reason to show.
I found this <!–(.|s)*?–> little regular expression that neatly did the trick.
Here is a quick simple function ,that can be remove the HTML Comments from the given content.
function removeHtmlComments($content = '') { return preg_replace('//', '', $content); }