nei commenti di php.net c'è questa funzione:
http://www.php.net/manual/en/function.nl2br.php#98391
L'hai già provata?
Codice PHP:
<?php
function nl2br_limit($string, $num){
$dirty = preg_replace('/\r/', '', $string);
$clean = preg_replace('/\n{4,}/', str_repeat('
', $num), preg_replace('/\r/', '', $dirty));
return nl2br($clean);
}
echo nl2br_limit($string,'2');
?>