3v4l.org

run code in 300+ PHP versions simultaneously
<?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);

preferences:
46.59 ms | 402 KiB | 5 Q