This was originally posted on 2007-03-03 to http://andrewho.co.uk/weblog/magic-quotes-gpc-and-array-map
Juxta over on the TextDrive forum pointed
out a good use of
PHP's array_map()
function that I hadn't thought of which gets around the
annoying fact that some hosts set magic_quotes_gpc
to on. In short:
if (get_magic_quotes_gpc()) {
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
}