3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = '<!doctype html> <html> <head> <script type="text/javascript">alert(fasdfsd)</script> <meta charset="utf-8"> <script type="text/javascript"> var fasdfsd="fasdfsd"; </script> <script type="text/javascript" src="http://google.adv.js" /> <title> hey </title> <link rel="stylesheet" href="fdsa.css" /> <script type="text/javascript" src="http://google.adv.js" /> <script type="text/javascript" src="http://google.adv.js"/> <script> alert("hello"); </script> <script type="text/javascript" src="lfasd.js"></script> </head> <body> hey </body> </html>'; $str = preg_replace("@<script[^>]*?>.*?(\s)+/>@siu", "", $str); $str = preg_replace("@<script[^>]*?>.*?</script>@siu","",$str); echo html_entity_decode($str);
based on HUhNE
Output for 4.3.0 - 7.2.0
<!doctype html> <html> <head> <title> hey </title> <link rel="stylesheet" href="fdsa.css" /> </head> <body> hey </body> </html>