There are too much confusion about \n and \r.
There are lot's of questions in stack about differences between \n and \r. In a nut shell My confusions/questions are:
Microsoft Windows / MS-DOS: \r\n
Acorn BBC and RISC OS spooled text output: \n\r
Apple Macintosh OS 9 and earlier: \r
Unix (e.g., Linux), also Apple OS X and higher: \n
replace -> nl2br
more on that here
If new lines exists in the textarea than \n,\r or \r\n are present! These are control characters which are not outputted.
To remove them you could try:
$string = str_replace(array("\r\n", "\n\r", "\r", "\n"), "", $string);