I know it's stupid question, but I cannot to google anything for my problem.
I have $q = "This is\\same text"; and do
$q = stripslashes($q);
So, $q is now equal to "This issame text"! How I can to save one backslash?
Thank you.
I know it's stupid question, but I cannot to google anything for my problem.
I have $q = "This is\\same text"; and do
$q = stripslashes($q);
So, $q is now equal to "This issame text"! How I can to save one backslash?
Thank you.
The script does, what it's told, actually.
In
$q, the double backslash evaluates to a single backslash (the first escapes the second backslash), which is then stripped away.If meta-characters are not to be evaluated, you'll need to use single quotes:
EDIT
According to your comment in Michaels answerthere may be some confusion as to how many valid backslashes there are in your input. Consider the following input:The first would actually contain
This is \\some <TAB>ext. This is due to PHP leaving invalid control characters as-is.\s, as opposed to\tis an invalid control character and is thus left in place.The second string, however, would literally contain what's in the single quotes, since no evaluation is applied.