Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

Str_Replace(Array("\r", "\n"), ' ', $Value) Won't Recognize The \r And \n In A String

Recommended Posts

I've found that in order for the following line of code from script 13.1 - email.php to work


$value = str_replace(array("\r", "\n", "%0a", "%0d"), ' ', $value);


the \r and \n should be escaped like so:


$value = str_replace(array("\\r", "\\n", "%0a", "%0d"), ' ', $value);


Otherwise they won't be replaced.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...