chop(), trim(), ltrim() ...
All in the manual in the String functions section. RTFM!
If you want to replace with <BR> tags, you'll need to cater for Win32. From a source I can't be arsed to look for again:
"The Mac uses carriage returns to terminate lines of text; Unix uses line feeds; Windows uses the sequence 'carriage return / line feed'."
So you should use str_replace() or ereg_replace() to do it, depending on how many platforms you need to cater for:
$string = ereg_replace"\n|\r|\r\n|\n\r", "<br>", $string);
Depending on where the data is coming from, you may need to escape some of those breaks and returns too.
a
d
a
m