What do you mean locally?
If you mean "on my server", change the value in php.ini.
If you mean "for the currently executing script", the answer is "you can't".
magic_quotes_gpc takes effect before your PHP script begins to run. That makes sense, since it processes form input available to your script.
I suggest writing a function that replaces addslashes():
function my_addslashes($str)
{
return get_magic_quotes_gpc()? $str : addslashes($str);
}
This function checks whether magic_quotes_gpc is set. If it is, return the string unmodified. If magic_quotes_gpc is off, return the string after processing it with addslashes().
If you need a function that de-slash-ifies form input, you can do that too:
function deslashify($str)
{
return get_magic_quotes_gpc()? stripslashes($str) : $str;
}
This version runs stripslashes() on your string if magic_quotes_gpc is ON, and leaves it alone if it's not.
Bear in mind that you shouldn't really ever need a function like deslashify(), I just provided it for the sake of completeness and example.
Also, you should only use my_addslashes() on request input (i.e. GET, POST, and COOKIE data).
An alternative name for my_addslashes() that might be more appropriate is safe_addslashes() or protected_addslashes().
Hope this all helps,
Take care,
Nik
http://www.bigaction.org/