PHP – HTML Remove JavaScript

PHP – HTML Remove JavaScript

I am trying to remove JavaScript from the HTML.

In addition use strip_tags in php function

echo strip_tags("Hello <b>world!</b>");

output:

Hello world!

you can use :

echo preg_replace('/<script\b[^>]*>(.*?)<\/script>/is', "", $var);

Leave a Reply

Your email address will not be published. Required fields are marked *