How could you remove the extra lines, for example:
text text text text text
And I would like that to be so.
text text text
I already use nl2br ($ desc) so line breaks appear in general now, how to limit them 1
Before using nl2br(), replace all carriage return sequences or new string characters with a single new line:
nl2br()
$result = preg_replace('/[\r\n]+/', "\n", $desc);
See how it works on the Internet: ideone
after nl2br()do:
$desc = preg_replace('#(<br[ ]?[\/]?>[\r\n]*)+#','<br/>',$desc);