Codice PHP:
$testo nl2br(trim($_REQUEST["textarea"]));
$testo str_replace(array("\n""\r""\\0"), array(''''''), $testo));