If you want to apply this function to a multi-dimensional array, you need to use a recursive function. Example 2 Using stripslashes on an array. Submit a Pull Request Report a Bug. Parameters string The input string. Return Values Returns a string with backslashes stripped off. Sometimes for some reason is happens that PHP or Javascript or some naughty insert a lot of backslash. Ordinary function does not notice that. This flick has served me wery well, because I had this problem before. This way, my data is already clean by the time I want to use it.
Last Updated : 28 Mar, Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments. Every time I've seen it used it either shouldn't be or didn't have to be. Is it just for dealing with magic quotes?
Yeah, mainly manual material. Not saying it's a bad question, but I don't find it particularly good either. Add a comment. Active Oldest Votes. Improve this answer. Explosion Pills Explosion Pills k 47 47 gold badges silver badges bronze badges. Thanks I think I understand it now, will chose as answer when I can. You can't learn too much about proper SQL escaping. I'd like to point out that some all?
Stripslashes is not unquoting a quoted string. This problem can really get out of hand when you re-submit these strings to the database, as each time the number of backslashes multiplies. No it's not. When you escape strings in a sql query, it is only to transport the data in the query. The database parses the query and stores the data in the database, without any extra slashes. Thus, when you retrieve data from the database, you should not unescape anything.
It's a common misconception. If you find that there are excess slashes in the output, you probably have magic quotes turned on.
0コメント