$html = "Hello world!<textarea>asdad</textarea>";
$html = preg_replace_callback('/\<textarea\>(.*?)<\/textarea\>/', function($matches) {
return '<textarea>' . preg_replace('/\r?\n/', 'XXX', $matches[1]) . '</textarea>';
}, $html);
$html = preg_replace('/(<!--(.*?)-->|\/\*(.*?)\*\/|^\/\/.*$|[\n\r\t])/m', '', $html);
$html = str_replace('XXX', "\r\n", $html);