3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = '<!doctype html> <html> <head> <meta charset="utf-8"> <title> hey </title> <script> alert("hello"); </script> </head> <body> hey </body> </html>'; $str = preg_replace("@<script[^>]*?>.*?</script>@siu","",$str); echo htmlentities($str);
Output for 4.3.0 - 7.2.0
&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;title&gt; hey &lt;/title&gt; &lt;/head&gt; &lt;body&gt; hey &lt;/body&gt; &lt;/html&gt;