Why not just replace more than one newline before calling nl2br?
If you want to allow them to use only one new line in your message:
$firstPos = strpos($text, "\n");
if ($firstPos !== false) {
$text = substr_replace(array("\r","\n"),'', $text, $firstPos + 1);
}
$text = nl2br($text);
If you want to allow them to use only one consecutive new line (allowing foo\nbar\nbaz):
$text = preg_replace('#[\r\n]+#', "\n", $text);
$text = nl2br($text);
source
share