Jump to content

remove tags


dreamwest

Recommended Posts

Whats the best way to remove <script> and <style> tags including the content between them?

 

 

$txt = "html stuff <script>javascript stuff</script> html stuff <style>.co{color:red}</style>html";

if(preg_match('~<script(.*?)</script>~is', $txt)){

//remove <script> content from $txt

}

 

Link to comment
https://forums.phpfreaks.com/topic/229339-remove-tags/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.