I'm trying to replace carriage return with line break in PHP so that my site moderators don't enter
every time they want to add a new line when entering email from my site. I tried several different methods to replace line breaks, but none worked. Methods I tried:
preg_replace('/\r\n?/', "<br />", $str); eregi_replace(char(13), "<br />", $str); str_replace("\r\n", "<br />", $str); str_replace("\n", "<br />", $str);
and nl2br functions.
I searched Google for about half an hour and found nothing. Can anyone help?
source share