<?php
$txt = '
<div></div>
<script params...>text1</script>
<style params...>text2</style>
<p params...>text3</p>';
print preg_replace('/(<(script|style)\b[^>]*>).*?(<\/\2>)/s', "$1$3", $txt);
PD9waHAKCiR0eHQgPSAnCiA8ZGl2PjwvZGl2PgogPHNjcmlwdCBwYXJhbXMuLi4+dGV4dDE8L3NjcmlwdD4KIDxzdHlsZSBwYXJhbXMuLi4+dGV4dDI8L3N0eWxlPgogPHAgcGFyYW1zLi4uPnRleHQzPC9wPic7CgpwcmludCBwcmVnX3JlcGxhY2UoJy8oPChzY3JpcHR8c3R5bGUpXGJbXj5dKj4pLio/KDxcL1wyPikvcycsICIkMSQzIiwgJHR4dCk7