How can I remove a line break and trailing spaces from a s ting? I am exporting a MySQL database and one field has some html in it. I exporting it into a Froogle-compatible file which does not allow html. I use strip_tags to remove the html, but when I look at the text file, any line that had html tags removed has an unknown-character box (the outline square in notepad) and it breaks the format that froogle needs.
Any ideas?
Do you mean like this?
$string = " my\n text "; $string = trim($string); $string = str_replace("\n", "", $string);
Also mark that trim() removes any whitespace character including \n in the start and end of the string.