stuckwithcode
-
Posts
76 -
Joined
-
Last visited
Never
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
str_replace Help!
in PHP Coding Help
Posted
I am trying to make sure that all line breaks in a piece of text are converted to \r\n. When I use the code below for:
a
b
c
$text = str_replace(array("\r\n","\r","\n"), "\r\n", $text);
After using mysql_real_escape_string the output shows:
a\r\r\n\r\nb\r\r\n\r\nc
Where am I going wrong? I expected it to remain at a\r\nb\r\nc
If I use $text = str_replace(array("\r\n","\r","\n"), "\r", $text); , it works.