Jump to content
Larry Ullman's Book Forums

Adding Backslashes, Script 13.1 Step 5

Recommended Posts


I have small problem with script 13.1, particularly with step 5.
Book explains that this code:

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

is going to create new value that is free of newline characters.


It is true when I enter to the form string with "%0a" and "%0d" but it is not true for "\r" and "\n".
When entering email "test@test.com\n" it creates "test@test.com\\n" (it adds backslash).


Does anyone know why this is happening?
Thanks for any suggestion.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.


  • Create New...