note 104204 deleted from function.stripslashes by danbrown
| From: | danbrown@php.net | Date: | Tue, 31 May 2011 22:37:25 +0000 |
| Subject: | note 104204 deleted from function.stripslashes by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180148@lists.php.net to get a copy of this message | ||
Note Submitter: Kent
----
Haha.. I love the example here.
$s = "Let\'s post a plug for O\'Rielly";
Why anyone would use stripslashes to read this string is beyond me!
In this case, the backslashes are useless since they are escaping single quotes in a double quoted
string.
But even if converting it to:
$s = 'Let\'s post a plug for O\'rielly';
It would only act as a signal to the php interpreter that ' is not the end of the string... the
string in memory WOULD NOT HAVE THE SLASHES.
* You actually need the slashes in the string being stripped... it's stripping the slashes...
no slashes, no stripping (er.. uh whatever)
Try:
$a = "\\\"This needs strip slashes\\\"";
print $a . '<br />' . stripslashes($a);
But watch out: You want to have a reasonable amount of certainty that the string was escaped (adding
slashes) or you can corrupt your data.