[ andrewho dot co dot uk ]

magic_quotes_gpc and array_map() 2007-03-03 at 00:42

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);
}