Page 1 of 1
Turn off Addslashes
Posted: Tue Aug 22, 2006 8:10 pm
by nickman013
Hello,
I want to know how to turn off add slashes or remove slashes w/e it is. I have slashes that appear next to ' and " and it gets very annoying. Can I turn thiss off in my php.ini?
Thanks.
Posted: Tue Aug 22, 2006 8:15 pm
by feyd
Yes, you can turn it off in php.ini, however you should write your scripts to support the functionality being on or off.
get_magic_quotes_gpc() and
get_magic_quotes_runtime() are used to detect when to run
stripslashes() on a value.
The manual pages detail what php.ini settings affect them. Take notice of the notes placed on the pages too.
Posted: Tue Aug 22, 2006 9:45 pm
by Luke
here is a function written by arborint that removes those slashes... it can handle either a standard value (string) or an array of values (strings):
Code: Select all
function removeSlashes(&$var) {
if (is_array($var)) {
foreach ($var as $name => $value) {
if (is_array($value)) {
removeSlashes($value);
} else {
$var[$name] = stripslashes($value);
}
}
} else {
$var = stripslashes($var);
}
}
Posted: Tue Aug 22, 2006 11:42 pm
by nickman013
Thanks!!!