NYCPHP Meetup

[nycphp-talk] PHP Versions and GLOBALS

David Rydell drydell at worldnet.att.net
Tue Jun 25 16:16:28 EDT 2002


if you have lots of scripts expecting register_globals=on, just prepend them
with code like this and you'll never need to worry about it...

if ($GLOBALS)

    reset ($GLOBALS);
    while (list ($key, $value) = each ($GLOBALS)) { ${$key} = $value; }
}

if ($HTTP_SERVER_VARS)

    reset ($HTTP_SERVER_VARS);
    while (list ($key, $value) = each ($HTTP_SERVER_VARS)) { ${$key} =
$value; }
}

if ($HTTP_GET_VARS)

    reset ($HTTP_GET_VARS);
    while (list ($key, $value) = each ($HTTP_GET_VARS)) { ${$key} =
$value; }
}

if ($HTTP_POST_VARS)

    reset ($HTTP_POST_VARS);
    while (list ($key, $value) = each ($HTTP_POST_VARS)) { ${$key} =
$value; }
}





More information about the talk mailing list