How to Remove HTML Comments with PHP?

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.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.