On Thu, 10 Jun 2004, Andre Cerqueira wrote: > > But the manual doesn't say that it *only* removes slashes > > added by addslashes. > > "Returns a string with backslashes stripped off. (\' becomes ' and so > on.) Double backslashes (\\) are made into a single backslash (\)." > > Yes, it doesn't *say*, but i think anyone could see that implied if one > didn't have previous knowledge of what it really does. > > I understand it works exactly how its supposed to, but why is it > supposed to work this way? > Inspired in something from another project? > Probably what I'm thinking as the right behavior, is what someone that > hasn't put enough thought on it would think hehe > To sum up: why was the real way choosen?
I saw no real-world reason not to do it this way. Functions that trim or strip stuff should trim or strip that stuff. If you are stripping tags, you strip tags. If you are stripping slashes, you strip slashes. If you want a function that only strips slashes in a certain context, then it should be called something like strip_context_slashes. Like strip_sql_slashes. And before you start arguing that addslashes breaks that rule, it is pretty clear that anything that adds has to have some sort of context associated with it. -Rasmus -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php